diff --git a/core/modules/statistics/statistics.module b/core/modules/statistics/statistics.module index b691acf..4f72553 100644 --- a/core/modules/statistics/statistics.module +++ b/core/modules/statistics/statistics.module @@ -82,7 +82,7 @@ function statistics_exit() { db_insert('accesslog') ->fields(array( 'title' => truncate_utf8(strip_tags(drupal_get_title()), 255), - 'path' => substr($_GET['q'], 0, 255), + 'path' => truncate_utf8($_GET['q'], 255), 'url' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '', 'hostname' => ip_address(), 'uid' => $user->uid, diff --git a/core/modules/statistics/statistics.test b/core/modules/statistics/statistics.test index f1db4f5..a014767 100644 --- a/core/modules/statistics/statistics.test +++ b/core/modules/statistics/statistics.test @@ -136,7 +136,7 @@ class StatisticsLoggingTestCase extends DrupalWebTestCase { $this->drupalGet($long_path); $log = db_query('SELECT * FROM {accesslog}')->fetchAll(PDO::FETCH_ASSOC); $this->assertTrue(is_array($log) && count($log) == 8, 'Page request was logged for a path over 255 characters.'); - $this->assertEqual($log[7]['path'], substr($long_path, 0, 255)); + $this->assertEqual($log[7]['path'], truncate_utf8($long_path, 255)); } }