Index: modules/statistics/statistics.module =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.module,v retrieving revision 1.242 diff -u -p -r1.242 statistics.module --- modules/statistics/statistics.module 22 Oct 2006 08:28:46 -0000 1.242 +++ modules/statistics/statistics.module 16 Nov 2006 11:29:29 -0000 @@ -65,12 +65,14 @@ function statistics_init() { if (variable_get('statistics_count_content_views', 0)) { // We are counting content views. if ((arg(0) == 'node') && is_numeric(arg(1)) && arg(2) == '') { - // A node has been viewed, so update the node's counters. - db_query('UPDATE {node_counter} SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = %d WHERE nid = %d', time(), arg(1)); - // If we affected 0 rows, this is the first time viewing the node. - if (!db_affected_rows()) { - // We must create a new row to store counters for the new node. - db_query('INSERT INTO {node_counter} (nid, daycount, totalcount, timestamp) VALUES (%d, 1, 1, %d)', arg(1), time()); + if (!variable_get('statistics_enable_access_log', 0) || !db_num_rows(db_query("SELECT title FROM {accesslog} WHERE path = '%s' AND sid = '%s' AND uid = %d", $_GET['q'], session_id(), $user->uid))) { + // A node has been viewed, so update the node's counters. + db_query('UPDATE {node_counter} SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = %d WHERE nid = %d', time(), arg(1)); + // If we affected 0 rows, this is the first time viewing the node. + if (!db_affected_rows()) { + // We must create a new row to store counters for the new node. + db_query('INSERT INTO {node_counter} (nid, daycount, totalcount, timestamp) VALUES (%d, 1, 1, %d)', arg(1), time()); + } } } }