Index: modules/statistics/statistics.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/statistics/statistics.module,v
retrieving revision 1.246
diff -u -u -p -r1.246 statistics.module
--- modules/statistics/statistics.module	26 Nov 2006 02:20:01 -0000	1.246
+++ modules/statistics/statistics.module	20 Dec 2006 22:57:00 -0000
@@ -66,6 +66,14 @@ function statistics_init() {
       }
     }
   }
+}
+
+/**
+ * Implementation of hook_exit().
+ *
+ * We insert accesslog stats here to get accurate timer statistics.
+ */
+function statistics_exit() {
   if ((variable_get('statistics_enable_access_log', 0)) && (module_invoke('throttle', 'status') == 0)) {
     // Log this page access.
     db_query("INSERT INTO {accesslog} (title, path, url, hostname, uid, sid, timer, timestamp) values('%s', '%s', '%s', '%s', %d, '%s', %d, %d)", strip_tags(drupal_get_title()), $_GET['q'], referer_uri(), $_SERVER['REMOTE_ADDR'], $user->uid, session_id(), timer_read('page'), time());
