<?php
function saveProductStat( $iProduct ){
	$oDB = & DataBase::getInstance( );
	$oDB->save( DB_PRODUCTS_STATS, Array( 'iProduct' => $iProduct, 'iTime' => time( ), 'sRefererUrl' => preg_replace( '>^(https?|android-app)://(www\\.)?>', '', $_SERVER['HTTP_REFERER'] ), 'sRefererDomain' => preg_replace( '>^(https?|android-app)://(www\\.)?([^/]+).*?$>', '$3', $_SERVER['HTTP_REFERER'] ) ) );
	$oDB->update( DB_PRODUCTS, Array( 'iLastVisited' => time( ) ), Array( 'iProduct' => $iProduct ) );
}
function strtolower_utf8( $sWords ){
	return mb_strtolower( $sWords, 'UTF-8' );
}
?>