diff --git a/modules/pagesnotfound/pagesnotfound.php b/modules/pagesnotfound/pagesnotfound.php index b8a0e40ec..020e970e2 100644 --- a/modules/pagesnotfound/pagesnotfound.php +++ b/modules/pagesnotfound/pagesnotfound.php @@ -35,7 +35,7 @@ class Pagesnotfound extends Module { $this->name = 'pagesnotfound'; $this->tab = 'analytics_stats'; - $this->version = 1.0; + $this->version = 1.1; $this->author = 'PrestaShop'; $this->need_instance = 0; @@ -167,14 +167,17 @@ class Pagesnotfound extends Module $_SERVER['REQUEST_URI'] = $_SERVER['REDIRECT_URL']; if (!Validate::isUrl($request_uri = $_SERVER['REQUEST_URI']) || strstr($_SERVER['REQUEST_URI'], '-admin404')) return; - if (strstr($_SERVER['PHP_SELF'], '404.php') && !strstr($_SERVER['REQUEST_URI'], '404.php')) + + if (get_class(Context::getContext()->controller) == 'PageNotFoundController') { $http_referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; if (empty($http_referer) || Validate::isAbsoluteUrl($http_referer)) + { Db::getInstance()->execute(' INSERT INTO `'._DB_PREFIX_.'pagenotfound` (`request_uri`, `http_referer`, `date_add`, `id_shop`, `id_shop_group`) VALUES (\''.pSQL($request_uri).'\', \''.pSQL($http_referer).'\', NOW(), '.(int)$this->context->shop->id.', '.(int)$this->context->shop->id_shop_group.') '); + } } } }