diff --git a/modules/statistics.module b/modules/statistics.module index d01983bce5c2fb131d9107e40d84019d88cc4084..1869b5c0ec4feac8819d233eb1b747b1988239d2 100644 --- a/modules/statistics.module +++ b/modules/statistics.module @@ -185,7 +185,7 @@ function statistics_node_tracker() { while ($log = db_fetch_object($result)) { $rows[] = array( array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'), - l(_statistics_column_width($log->url), $log->url), + _statistics_link($log->url), theme('username', $log), l(t('details'), "admin/logs/access/$log->aid")); } @@ -325,7 +325,7 @@ function statistics_top_referrers() { $result = pager_query($query, 30, 0, $query_cnt, $_SERVER['HTTP_HOST']); while ($referrer = db_fetch_object($result)) { - $rows[] = array($referrer->hits, '<a href="'. check_url($referrer->url) .'">'. check_plain(_statistics_column_width($referrer->url)) .'</a>', t('%time ago', array('%time' => format_interval(time() - $referrer->last)))); + $rows[] = array($referrer->hits, _statistics_link($referrer->url), t('%time ago', array('%time' => format_interval(time() - $referrer->last)))); } $output = theme('table', $header, $rows); @@ -468,14 +468,16 @@ function statistics_block($op = 'list', $delta = 0, $edit = array()) { * It is possible to adjust the width of columns generated by the * statistics module. */ -function _statistics_column_width($column, $width = 35) { - return (strlen($column) > $width ? substr($column, 0, $width) . '...' : $column); +function _statistics_link($path, $width = 35) { + $title = drupal_get_path_alias($path); + $title = truncate_utf8($title, $width, FALSE, TRUE); + return l($title, $path); } -function _statistics_format_item($title, $link) { - $link = ($link ? $link : '/'); +function _statistics_format_item($title, $path) { + $path = ($path ? $path : '/'); $output = ($title ? "$title<br />" : ''); - $output .= l(_statistics_column_width($link), $link); + $output .= _statistics_link($path); return $output; } diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index d01983bce5c2fb131d9107e40d84019d88cc4084..1869b5c0ec4feac8819d233eb1b747b1988239d2 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -185,7 +185,7 @@ function statistics_node_tracker() { while ($log = db_fetch_object($result)) { $rows[] = array( array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'), - l(_statistics_column_width($log->url), $log->url), + _statistics_link($log->url), theme('username', $log), l(t('details'), "admin/logs/access/$log->aid")); } @@ -325,7 +325,7 @@ function statistics_top_referrers() { $result = pager_query($query, 30, 0, $query_cnt, $_SERVER['HTTP_HOST']); while ($referrer = db_fetch_object($result)) { - $rows[] = array($referrer->hits, '<a href="'. check_url($referrer->url) .'">'. check_plain(_statistics_column_width($referrer->url)) .'</a>', t('%time ago', array('%time' => format_interval(time() - $referrer->last)))); + $rows[] = array($referrer->hits, _statistics_link($referrer->url), t('%time ago', array('%time' => format_interval(time() - $referrer->last)))); } $output = theme('table', $header, $rows); @@ -468,14 +468,16 @@ function statistics_block($op = 'list', $delta = 0, $edit = array()) { * It is possible to adjust the width of columns generated by the * statistics module. */ -function _statistics_column_width($column, $width = 35) { - return (strlen($column) > $width ? substr($column, 0, $width) . '...' : $column); +function _statistics_link($path, $width = 35) { + $title = drupal_get_path_alias($path); + $title = truncate_utf8($title, $width, FALSE, TRUE); + return l($title, $path); } -function _statistics_format_item($title, $link) { - $link = ($link ? $link : '/'); +function _statistics_format_item($title, $path) { + $path = ($path ? $path : '/'); $output = ($title ? "$title<br />" : ''); - $output .= l(_statistics_column_width($link), $link); + $output .= _statistics_link($path); return $output; }