diff --git a/core/modules/search/search.test b/core/modules/search/search.test
index 6085465..1f88c8b 100644
--- a/core/modules/search/search.test
+++ b/core/modules/search/search.test
@@ -459,6 +459,7 @@ class SearchRankingTestCase extends SearchWebTestCase {
     for ($i = 0; $i < 5; $i ++) {
       drupal_http_request($stats_path, array('method' => 'POST', 'data' => $post, 'headers' => $headers, 'timeout' => 10000));
     }
+    $this->cronRun();
 
     // Test each of the possible rankings.
     foreach ($node_ranks as $node_rank) {
diff --git a/core/modules/statistics/statistics.module b/core/modules/statistics/statistics.module
index ef1bceb..7d5ce71 100644
--- a/core/modules/statistics/statistics.module
+++ b/core/modules/statistics/statistics.module
@@ -231,6 +231,21 @@ function statistics_user_predelete($account) {
  */
 function statistics_cron() {
   $statistics_timestamp = variable_get('statistics_day_timestamp', '');
+  
+  $queue = queue('node_counter');
+  while ($item = $queue->claimItem()) {
+      db_merge('node_counter')
+            ->key(array('nid' => $item->data))
+            ->fields(array(
+              'daycount' => 1,
+              'totalcount' => 1,
+              'timestamp' => REQUEST_TIME,
+            ))
+            ->expression('daycount', 'daycount + 1')
+            ->expression('totalcount', 'totalcount + 1')
+            ->execute();
+      $queue->deleteItem($item);
+    }
 
   if ((REQUEST_TIME - $statistics_timestamp) >= 86400) {
     // Reset day counts.
diff --git a/core/modules/statistics/statistics.php b/core/modules/statistics/statistics.php
index 040dc19..1ab0d1e 100644
--- a/core/modules/statistics/statistics.php
+++ b/core/modules/statistics/statistics.php
@@ -14,20 +14,12 @@ chdir('../../..');
 define('DRUPAL_ROOT', getcwd());
 
 include_once DRUPAL_ROOT . '/core/includes/bootstrap.inc';
-drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES);
+drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
 if (variable_get('statistics_count_content_views', 0)) {
   $nid = $_POST['nid'];
   if (is_numeric($nid)) {
-    db_merge('node_counter')
-      ->key(array('nid' => $nid))
-      ->fields(array(
-        'daycount' => 1,
-        'totalcount' => 1,
-        'timestamp' => REQUEST_TIME,
-      ))
-      ->expression('daycount', 'daycount + 1')
-      ->expression('totalcount', 'totalcount + 1')
-      ->execute();
+    $queue = queue('node_counter');
+    $queue->createItem($nid);
   }
 }
 
diff --git a/core/modules/statistics/statistics.test b/core/modules/statistics/statistics.test
index 3314761..14ee92a 100644
--- a/core/modules/statistics/statistics.test
+++ b/core/modules/statistics/statistics.test
@@ -96,50 +96,41 @@ class StatisticsLoggingTestCase extends DrupalWebTestCase {
    * Verifies request logging for cached and uncached pages.
    */
   function testLogging() {
+    global $base_url;
     $path = 'node/' . $this->node->nid;
     $expected = array(
       'title' => $this->node->title,
       'path' => $path,
     );
 
-    // Verify logging of an uncached page.
-    $this->drupalGet($path);
+    // Verify logging
     // Manually calling statistics.php, simulating ajax behavior.
     $nid = $this->node->nid;
     $post = http_build_query(array('nid' => $nid));
     $headers = array('Content-Type' => 'application/x-www-form-urlencoded');
-    global $base_url;
     $stats_path = $base_url . '/' . drupal_get_path('module', 'statistics'). '/statistics.php';
     drupal_http_request($stats_path, array('method' => 'POST', 'data' => $post, 'headers' => $headers, 'timeout' => 10000));
+    $this->drupalGet($path);
     $this->assertIdentical($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', t('Testing an uncached page.'));
     $log = db_query('SELECT * FROM {accesslog}')->fetchAll(PDO::FETCH_ASSOC);
-    $this->assertTrue(is_array($log) && count($log) == 1, t('Page request was logged.'));
+    $this->assertIdentical(count($log), 1);
     $this->assertEqual(array_intersect_key($log[0], $expected), $expected);
+    $this->cronRun();
     $node_counter = statistics_get($this->node->nid);
     $this->assertIdentical($node_counter['totalcount'], '1');
 
-    // Verify logging of a cached page.
-    $this->drupalGet($path);
-    // Manually calling statistics.php, simulating ajax behavior.
-    drupal_http_request($stats_path, array('method' => 'POST', 'data' => $post, 'headers' => $headers, 'timeout' => 10000));
-    $this->assertIdentical($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Testing a cached page.'));
-    $log = db_query('SELECT * FROM {accesslog}')->fetchAll(PDO::FETCH_ASSOC);
-    $this->assertTrue(is_array($log) && count($log) == 2, t('Page request was logged.'));
-    $this->assertEqual(array_intersect_key($log[1], $expected), $expected);
-    $node_counter = statistics_get($this->node->nid);
-    $this->assertIdentical($node_counter['totalcount'], '2');
-
     // Test logging from authenticated users
     $this->drupalLogin($this->auth_user);
-    $this->drupalGet($path);
     // Manually calling statistics.php, simulating ajax behavior.
     drupal_http_request($stats_path, array('method' => 'POST', 'data' => $post, 'headers' => $headers, 'timeout' => 10000));
+    $this->drupalGet($path);
     $log = db_query('SELECT * FROM {accesslog}')->fetchAll(PDO::FETCH_ASSOC);
     // Check the 6th item since login and account pages are also logged
-    $this->assertTrue(is_array($log) && count($log) == 6, t('Page request was logged.'));
-    $this->assertEqual(array_intersect_key($log[5], $expected), $expected);
+    $this->assertIdentical(count($log), 6);
+    $this->assertEqual(array_intersect_key($log[5], $expected), $expected); 
+    $this->cronRun();
     $node_counter = statistics_get($this->node->nid);
-    $this->assertIdentical($node_counter['totalcount'], '3');
+    $this->assertIdentical($node_counter['totalcount'], '2');
 
     // Visit edit page to generate a title greater than 255.
     $path = 'node/' . $this->node->nid . '/edit';
@@ -149,8 +140,8 @@ class StatisticsLoggingTestCase extends DrupalWebTestCase {
     );
     $this->drupalGet($path);
     $log = db_query('SELECT * FROM {accesslog}')->fetchAll(PDO::FETCH_ASSOC);
-    $this->assertTrue(is_array($log) && count($log) == 7, t('Page request was logged.'));
-    $this->assertEqual(array_intersect_key($log[6], $expected), $expected);
+    $this->assertIdentical(count($log), 8);
+    $this->assertEqual(array_intersect_key($log[7], $expected), $expected);
 
     // Create a path longer than 255 characters. Drupal's .htaccess file
     // instructs Apache to test paths against the file system before routing to
@@ -163,8 +154,8 @@ class StatisticsLoggingTestCase extends DrupalWebTestCase {
     // Test that the long path is properly truncated when logged.
     $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'], truncate_utf8($long_path, 255));
+    $this->assertIdentical(count($log), 9);
+    $this->assertEqual($log[8]['path'], truncate_utf8($long_path, 255));
 
   }
 }
@@ -232,16 +223,17 @@ class StatisticsReportsTestCase extends StatisticsTestCase {
    * Tests the "popular content" block.
    */
   function testPopularContentBlock() {
+    global $base_url;
     // Visit a node to have something show up in the block.
     $node = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->blocking_user->uid));
-    $this->drupalGet('node/' . $node->nid);
     // Manually calling statistics.php, simulating ajax behavior.
     $nid = $node->nid;
     $post = http_build_query(array('nid' => $nid));
     $headers = array('Content-Type' => 'application/x-www-form-urlencoded');
-    global $base_url;
     $stats_path = $base_url . '/' . drupal_get_path('module', 'statistics'). '/statistics.php';
     drupal_http_request($stats_path, array('method' => 'POST', 'data' => $post, 'headers' => $headers, 'timeout' => 10000));
+    $this->cronRun();
+    $this->drupalGet('node/' . $node->nid);
 
     // Configure and save the block.
     $block = block_load('statistics', 'popular');
@@ -361,6 +353,7 @@ class StatisticsAdminTestCase extends DrupalWebTestCase {
    * Verifies that the statistics settings page works.
    */
   function testStatisticsSettings() {
+    global $base_url;
     $this->assertFalse(variable_get('statistics_enable_access_log', 0), t('Access log is disabled by default.'));
     $this->assertFalse(variable_get('statistics_count_content_views', 0), t('Count content view log is disabled by default.'));
 
@@ -373,45 +366,47 @@ class StatisticsAdminTestCase extends DrupalWebTestCase {
     $this->drupalPost('admin/config/system/statistics', $edit, t('Save configuration'));
     $this->assertTrue(variable_get('statistics_enable_access_log'), t('Access log is enabled.'));
     $this->assertTrue(variable_get('statistics_count_content_views'), t('Count content view log is enabled.'));
-
-    // Hit the node.
-    $this->drupalGet('node/' . $this->test_node->nid);
-    // Manually calling statistics.php, simulating ajax behavior.
+    
+    //Hit the node and manually call statistics.php
     $nid = $this->test_node->nid;
     $post = http_build_query(array('nid' => $nid));
     $headers = array('Content-Type' => 'application/x-www-form-urlencoded');
-    global $base_url;
     $stats_path = $base_url . '/' . drupal_get_path('module', 'statistics'). '/statistics.php';
     drupal_http_request($stats_path, array('method' => 'POST', 'data' => $post, 'headers' => $headers, 'timeout' => 10000));
-
+    $this->drupalGet('node/' . $nid);
+    
+    // Hit "Top pages" check node 1 is there
     $this->drupalGet('admin/reports/pages');
     $this->assertText('node/1', t('Test node found.'));
-
-    // Hit the node again (the counter is incremented after the hit, so
-    // "1 view" will actually be shown when the node is hit the second time).
-    $this->drupalGet('node/' . $this->test_node->nid);
+    
+    // Hit the node twice more
     drupal_http_request($stats_path, array('method' => 'POST', 'data' => $post, 'headers' => $headers, 'timeout' => 10000));
-    $this->assertText('1 view', t('Node is viewed once.'));
-
+    $this->cronRun();
     $this->drupalGet('node/' . $this->test_node->nid);
+    $this->assertText('2 view', t('Node is viewed twice.'));
+
     drupal_http_request($stats_path, array('method' => 'POST', 'data' => $post, 'headers' => $headers, 'timeout' => 10000));
-    $this->assertText('2 views', t('Node is viewed 2 times.'));
+    $this->cronRun();
+    $this->drupalGet('node/' . $this->test_node->nid);
+    $this->assertText('3 views', t('Node is viewed 3 times.'));
+    
   }
 
   /**
    * Tests that when a node is deleted, the node counter is deleted too.
    */
   function testDeleteNode() {
+    global $base_url;
     variable_set('statistics_count_content_views', 1);
 
-    $this->drupalGet('node/' . $this->test_node->nid);
     // Manually calling statistics.php, simulating ajax behavior.
     $nid = $this->test_node->nid;
     $post = http_build_query(array('nid' => $nid));
     $headers = array('Content-Type' => 'application/x-www-form-urlencoded');
-    global $base_url;
     $stats_path = $base_url . '/' . drupal_get_path('module', 'statistics'). '/statistics.php';
     drupal_http_request($stats_path, array('method' => 'POST', 'data' => $post, 'headers' => $headers, 'timeout' => 10000));
+    $this->cronRun();
+    $this->drupalGet('node/' . $this->test_node->nid);
 
     $result = db_select('node_counter', 'n')
       ->fields('n', array('nid'))
@@ -465,21 +460,20 @@ class StatisticsAdminTestCase extends DrupalWebTestCase {
    * Tests that cron clears day counts and expired access logs.
    */
   function testExpiredLogs() {
+    global $base_url;
     variable_set('statistics_enable_access_log', 1);
     variable_set('statistics_count_content_views', 1);
     variable_set('statistics_day_timestamp', 8640000);
     variable_set('statistics_flush_accesslog_timer', 1);
 
-    $this->drupalGet('node/' . $this->test_node->nid);
     // Manually calling statistics.php, simulating ajax behavior.
     $nid = $this->test_node->nid;
     $post = http_build_query(array('nid' => $nid));
     $headers = array('Content-Type' => 'application/x-www-form-urlencoded');
-    global $base_url;
     $stats_path = $base_url . '/' . drupal_get_path('module', 'statistics'). '/statistics.php';
     drupal_http_request($stats_path, array('method' => 'POST', 'data' => $post, 'headers' => $headers, 'timeout' => 10000));
+    $this->cronRun();
     $this->drupalGet('node/' . $this->test_node->nid);
-    drupal_http_request($stats_path, array('method' => 'POST', 'data' => $post, 'headers' => $headers, 'timeout' => 10000));
     $this->assertText('1 view', t('Node is viewed once.'));
 
     $this->drupalGet('admin/reports/pages');
@@ -519,6 +513,7 @@ class StatisticsTokenReplaceTestCase extends StatisticsTestCase {
    * Creates a node, then tests the statistics tokens generated from it.
    */
   function testStatisticsTokenReplacement() {
+    global $base_url;
     global $language_interface;
 
     // Create user and node.
@@ -526,15 +521,15 @@ class StatisticsTokenReplaceTestCase extends StatisticsTestCase {
     $this->drupalLogin($user);
     $node = $this->drupalCreateNode(array('type' => 'page', 'uid' => $user->uid));
 
-    // Hit the node.
-    $this->drupalGet('node/' . $node->nid);
     // Manually calling statistics.php, simulating ajax behavior.
     $nid = $node->nid;
     $post = http_build_query(array('nid' => $nid));
     $headers = array('Content-Type' => 'application/x-www-form-urlencoded');
-    global $base_url;
     $stats_path = $base_url . '/' . drupal_get_path('module', 'statistics'). '/statistics.php';
     drupal_http_request($stats_path, array('method' => 'POST', 'data' => $post, 'headers' => $headers, 'timeout' => 10000));
+    $this->cronRun();
+    // Hit the node.
+    $this->drupalGet('node/' . $node->nid);
     $statistics = statistics_get($node->nid);
 
     // Generate and test tokens.
