• Модуль: search
  • Путь к файлу: ~/bitrix/modules/search/classes/general/statistic.php
  • Класс: CSearchStatistic
  • Вызов: CSearchStatistic::GetCurrentURL
static function GetCurrentURL()
{
	$res = (CMain::IsHTTPS()? "https": "http")."://";

	$host = $_SERVER["HTTP_HOST"];
	$res .= $host;

	$port = intval($_SERVER["SERVER_PORT"]);
	if ($port > 0 && $port != 80 && $port != 443 && mb_strpos($host, ":") === false)
		$res .= ":".$port;

	$url = preg_replace("/\?sphrase_id=\d+&/", "?", $_SERVER["REQUEST_URI"]);
	$url = preg_replace("/\?sphrase_id=\d+/", "", $url);
	$url = preg_replace("/&sphrase_id=\d+/", "", $url);

	$res .= $url;

	return $res;
}