Not showing in the google table rows unneeded.

This commit is contained in:
Sergiotarxz 2023-05-07 18:20:42 +02:00
parent 52067b5647
commit 8269df919e
1 changed files with 7 additions and 3 deletions

View File

@ -101,10 +101,11 @@ EOF
return $data; return $data;
} }
my $GOOGLE_REFERER_REGEX = "'^https?://(?:www\\.)?google\\.\\w'";
my $GOOGLE_SELECT = "$SELECT_GLOBAL my $GOOGLE_SELECT = "$SELECT_GLOBAL
where requests.path = paths.path where requests.path = paths.path
and requests.referer IS NOT NULL and requests.referer IS NOT NULL
and requests.referer ~* '^https?://(?:www\\.)?google\\.\\w' and requests.referer ~* $GOOGLE_REFERER_REGEX
and date > NOW()"; and date > NOW()";
sub get_google_data { sub get_google_data {
@ -135,8 +136,11 @@ sub get_google_data {
( (
$GOOGLE_SELECT - interval '1 month' $GOOGLE_SELECT - interval '1 month'
) as unique_ips_last_month ) as unique_ips_last_month
FROM paths FROM paths right join requests on paths.path = requests.path
WHERE paths.last_seen > NOW() - INTERVAL '1 month'; WHERE paths.last_seen > NOW() - INTERVAL '1 month'
and requests.referer ~* $GOOGLE_REFERER_REGEX
GROUP BY
paths.path;
EOF EOF
return $data; return $data;
} }