function pagenotfound_reports_referers in Page Not Found Reports 6
Same name and namespace in other branches
- 6.2 pagenotfound_reports.admin.inc \pagenotfound_reports_referers()
- 7 pagenotfound_reports.module \pagenotfound_reports_referers()
List of 404s with referers.
1 string reference to 'pagenotfound_reports_referers'
- pagenotfound_reports_menu in ./
pagenotfound_reports.module - Implementation of hook_menu().
File
- ./
pagenotfound_reports.module, line 147 - Page Not Found Reports
Code
function pagenotfound_reports_referers() {
$oldest_item = db_result(db_query('SELECT timestamp FROM {watchdog} WHERE type = "page not found" AND referer IS NOT NULL AND referer != "" ORDER BY timestamp ASC LIMIT 1'));
$item_count = db_result(db_query('SELECT COUNT(wid) FROM {watchdog} WHERE type = "page not found" AND referer IS NOT NULL AND referer != ""'));
// Stats
// Do NOT call _pagenotfound_reports_summary_stats(), since only 404 erros
// with referrers are shown in this report
$list_items = array();
$list_items[] = t('%count: Total 404 errors with a referer available in log', array(
'%count' => $item_count,
));
$output = theme('item_list', $list_items);
$header = array(
array(
'data' => t('Count'),
'field' => 'count',
'sort' => 'desc',
),
array(
'data' => t('Path'),
'field' => 'message',
),
array(
'data' => t('Referer'),
'field' => 'referer',
),
array(
'data' => t('Operations'),
),
);
$result = pager_query("SELECT COUNT(wid) AS count, message, referer, wid FROM {watchdog} WHERE type = 'page not found' AND referer IS NOT NULL AND referer != '' GROUP BY message, referer " . tablesort_sql($header), 30, 0, "SELECT COUNT(DISTINCT(CONCAT(message, ':', referer))) FROM {watchdog} WHERE type = 'page not found' AND referer IS NOT NULL AND referer != ''");
$rows = array();
while ($dblog = db_fetch_object($result)) {
$rows[] = array(
$dblog->count,
truncate_utf8($dblog->message, 56, TRUE, TRUE),
l(truncate_utf8($dblog->referer, 56, TRUE, TRUE), $dblog->referer),
_pagenotfound_reports_add_operations($dblog),
);
}
if (empty($rows)) {
$rows[] = array(
array(
'data' => t('No log messages available.'),
'colspan' => 4,
),
);
}
$output .= theme('table', $header, $rows);
$output .= theme('pager', NULL, 30, 0);
return $output;
}