diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php
index 8443155fdc0fab8d33426f7c7a75f8c518a98070..d3c03e0ec61340178ba4790335a9b08ee5173139 100644
--- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php
+++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php
@@ -97,4 +97,5 @@ function testLogging() {
     $node_counter = statistics_get($this->node->id());
     $this->assertIdentical($node_counter['totalcount'], '1');
   }
+
 }
diff --git a/core/modules/statistics/statistics.php b/core/modules/statistics/statistics.php
index 59675f1cefc5a334ee032eebc7e403a7c7ddf597..03908f24bbc7d19002fa6d369e9d1dc90c77d531 100644
--- a/core/modules/statistics/statistics.php
+++ b/core/modules/statistics/statistics.php
@@ -11,12 +11,12 @@
 // Load the Drupal bootstrap.
 require_once dirname(dirname(__DIR__)) . '/vendor/autoload.php';
 require_once dirname(dirname(__DIR__)) . '/includes/bootstrap.inc';
-drupal_bootstrap(DRUPAL_BOOTSTRAP_PAGE_CACHE);
+drupal_bootstrap(DRUPAL_BOOTSTRAP_KERNEL);
 
 if (\Drupal::config('statistics.settings')->get('count_content_views')) {
   $nid = filter_input(INPUT_POST, 'nid', FILTER_VALIDATE_INT);
   if ($nid) {
-    db_merge('node_counter')
+    \Drupal::database()->merge('node_counter')
       ->key(array('nid' => $nid))
       ->fields(array(
         'daycount' => 1,