function statistics_top_referrers
Same name and namespace in other branches
- 7.x drupal-7.x/modules/statistics/statistics.admin.inc \statistics_top_referrers()
Menu callback; presents the "referrer" page.
1 string reference to 'statistics_top_referrers'
- statistics_menu in drupal-6.x/
modules/ statistics/ statistics.module - Implementation of hook_menu().
Archivo
- drupal-6.x/
modules/ statistics/ statistics.admin.inc, line 108 - Admin page callbacks for the statistics module.
Código
function statistics_top_referrers() {
$query = "SELECT url, COUNT(url) AS hits, MAX(timestamp) AS last FROM {accesslog} WHERE url NOT LIKE '%%%s%%' AND url <> '' GROUP BY url";
$query_cnt = "SELECT COUNT(DISTINCT(url)) FROM {accesslog} WHERE url <> '' AND url NOT LIKE '%%%s%%'";
drupal_set_title(t('Top referrers in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))));
$header = array(
array(
'data' => t('Hits'),
'field' => 'hits',
'sort' => 'desc',
),
array(
'data' => t('Url'),
'field' => 'url',
),
array(
'data' => t('Last visit'),
'field' => 'last',
),
);
$query .= tablesort_sql($header);
$result = pager_query($query, 30, 0, $query_cnt, $_SERVER['HTTP_HOST']);
$rows = array();
while ($referrer = db_fetch_object($result)) {
$rows[] = array($referrer->hits, _statistics_link($referrer->url), t('@time ago', array('@time' => format_interval(time() - $referrer->last))));
}
if (empty($rows)) {
$rows[] = array(array(
'data' => t('No statistics available.'),
'colspan' => 3,
));
}
$output = theme('table', $header, $rows);
$output .= theme('pager', NULL, 30, 0);
return $output;
}