diff --git a/core/modules/search/search.test b/core/modules/search/search.test
index 619055c..a4351f2 100644
--- a/core/modules/search/search.test
+++ b/core/modules/search/search.test
@@ -450,7 +450,7 @@ class SearchRankingTestCase extends SearchWebTestCase {
     $this->drupalPost(NULL, $edit, t('Save'));
 
     // Enable counting of statistics.
-    variable_set('statistics_count_content_views', 1);
+    config('statistics.settings')->set('statistics_count_content_views', 1)->save();
 
     // Then View one of the nodes a bunch of times.
     // Manually calling statistics.php, simulating ajax behavior.
diff --git a/core/modules/statistics/config/statistics.settings.xml b/core/modules/statistics/config/statistics.settings.xml
new file mode 100644
index 0000000..190fe4c
--- /dev/null
+++ b/core/modules/statistics/config/statistics.settings.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<config>
+  <statistics_enable_access_log>0</statistics_enable_access_log>
+  <statistics_flush_accesslog_timer>259200</statistics_flush_accesslog_timer>
+  <statistics_count_content_views>0</statistics_count_content_views>
+  <statistics_day_timestamp></statistics_day_timestamp>
+  <statistics_block_top_day_num>0</statistics_block_top_day_num>
+  <statistics_block_top_all_num>0</statistics_block_top_all_num>
+  <statistics_block_top_last_num>0</statistics_block_top_last_num>
+</config>
diff --git a/core/modules/statistics/statistics.admin.inc b/core/modules/statistics/statistics.admin.inc
index 87ae6a5..ed08616 100644
--- a/core/modules/statistics/statistics.admin.inc
+++ b/core/modules/statistics/statistics.admin.inc
@@ -93,7 +93,7 @@ function statistics_top_pages() {
     $rows[] = array($page->hits, _statistics_format_item($page->title, $page->path), t('%time ms', array('%time' => round($page->average_time))), format_interval(round($page->total_time / 1000)));
   }
 
-  drupal_set_title(t('Top pages in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))), PASS_THROUGH);
+  drupal_set_title(t('Top pages in the past %interval', array('%interval' => format_interval(config('statistics.settings')->get('statistics_flush_accesslog_timer')))), PASS_THROUGH);
   $build['statistics_top_pages_table'] = array(
     '#theme' => 'table',
     '#header' => $header,
@@ -153,7 +153,7 @@ function statistics_top_visitors() {
     $rows[] = array($account->hits, ($account->uid ? theme('username', array('account' => $account)) : $account->hostname), format_interval(round($account->total / 1000)), (user_access('block IP addresses') && !$account->uid) ? $ban_link : '');
   }
 
-  drupal_set_title(t('Top visitors in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))), PASS_THROUGH);
+  drupal_set_title(t('Top visitors in the past %interval', array('%interval' => format_interval(config('statistics.settings')->get('statistics_flush_accesslog_timer')))), PASS_THROUGH);
   $build['statistics_top_visitors_table'] = array(
     '#theme' => 'table',
     '#header' => $header,
@@ -175,7 +175,7 @@ function statistics_top_visitors() {
  *   A render array containing the top referrers information.
  */
 function statistics_top_referrers() {
-  drupal_set_title(t('Top referrers in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))), PASS_THROUGH);
+  drupal_set_title(t('Top referrers in the past %interval', array('%interval' => format_interval(config('statistics.settings')->get('statistics_flush_accesslog_timer')))), PASS_THROUGH);
 
   $header = array(
     array('data' => t('Hits'), 'field' => 'hits', 'sort' => 'desc'),
@@ -276,6 +276,8 @@ function statistics_access_log($aid) {
  */
 function statistics_settings_form() {
   // Access log settings.
+  $config = config('statistics.settings');
+
   $form['access'] = array(
     '#type' => 'fieldset',
     '#title' => t('Access log settings'),
@@ -283,13 +285,13 @@ function statistics_settings_form() {
   $form['access']['statistics_enable_access_log'] = array(
     '#type' => 'checkbox',
     '#title' => t('Enable access log'),
-    '#default_value' => variable_get('statistics_enable_access_log', 0),
+    '#default_value' => $config->get('statistics_enable_access_log'),
     '#description' => t('Log each page access. Required for referrer statistics.'),
   );
   $form['access']['statistics_flush_accesslog_timer'] = array(
     '#type' => 'select',
     '#title' => t('Discard access logs older than'),
-    '#default_value' => variable_get('statistics_flush_accesslog_timer', 259200),
+    '#default_value' => $config->get('statistics_flush_accesslog_timer'),
     '#options' => array(0 => t('Never')) + drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval'),
     '#description' => t('Older access log entries (including referrer statistics) will be automatically discarded. (Requires a correctly configured <a href="@cron">cron maintenance task</a>.)', array('@cron' => url('admin/reports/status'))),
   );
@@ -302,9 +304,25 @@ function statistics_settings_form() {
   $form['content']['statistics_count_content_views'] = array(
     '#type' => 'checkbox',
     '#title' => t('Count content views'),
-    '#default_value' => variable_get('statistics_count_content_views', 0),
+    '#default_value' => $config->get('statistics_count_content_views'),
     '#description' => t('Increment a counter each time content is viewed.'),
   );
 
-  return system_settings_form($form);
+  $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
+  return $form;
+}
+
+/**
+ * Form builder submit handler; Handle submission for statistics settings.
+ *
+ * @ingroup forms
+ * @see system_settings_form()
+ */
+function statistics_settings_form_submit($form, &$form_state) {
+  // Set the maintenance mode parameters.
+  $config = config('statistics.settings');
+  $config->set('statistics_enable_access_log', $form_state['values']['statistics_enable_access_log']);
+  $config->set('statistics_flush_accesslog_timer', $form_state['values']['statistics_flush_accesslog_timer']);
+  $config->set('statistics_count_content_views', $form_state['values']['statistics_count_content_views']);
+  $config->save();
 }
diff --git a/core/modules/statistics/statistics.install b/core/modules/statistics/statistics.install
index 5ee20dc..55670eb 100644
--- a/core/modules/statistics/statistics.install
+++ b/core/modules/statistics/statistics.install
@@ -6,20 +6,6 @@
  */
 
 /**
- * Implements hook_uninstall().
- */
-function statistics_uninstall() {
-  // Remove variables.
-  variable_del('statistics_count_content_views');
-  variable_del('statistics_enable_access_log');
-  variable_del('statistics_flush_accesslog_timer');
-  variable_del('statistics_day_timestamp');
-  variable_del('statistics_block_top_day_num');
-  variable_del('statistics_block_top_all_num');
-  variable_del('statistics_block_top_last_num');
-}
-
-/**
  * Implements hook_schema().
  */
 function statistics_schema() {
@@ -134,3 +120,21 @@ function statistics_schema() {
 
   return $schema;
 }
+
+/**
+ * @defgroup updates-7.x-to-8.x Updates from 7.x to 8.x
+ * @{
+ * Update functions from 7.x to 8.x.
+ */
+
+/**
+ * Moves statistics settings from variable to config.
+ */
+function statistics_update_8000() {
+  update_variables_to_config('statistics.settings');
+}
+
+/**
+ * @} End of "defgroup updates-7.x-to-8.x".
+ * The next series of updates should start at 9000.
+ */
diff --git a/core/modules/statistics/statistics.module b/core/modules/statistics/statistics.module
index ef1bceb..2d168ef 100644
--- a/core/modules/statistics/statistics.module
+++ b/core/modules/statistics/statistics.module
@@ -58,7 +58,29 @@ function statistics_exit() {
   // in which case we need to bootstrap to the session phase anyway.
   drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES);
 
-  if (variable_get('statistics_enable_access_log', 0)) {
+<<<<<<< HEAD
+  // Get the configuration for the settings.
+  $config = config('statistics.settings');
+  $statistics_count_content_views = $config->get('statistics_count_content_views');
+  $statistics_enable_access_log = $config->get('statistics_enable_access_log');
+
+  if (!empty($statistics_count_content_views)) {
+    // We are counting content views.
+    if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == NULL) {
+      // A node has been viewed, so update the node's counters.
+      db_merge('node_counter')
+        ->key(array('nid' => arg(1)))
+        ->fields(array(
+          'daycount' => 1,
+          'totalcount' => 1,
+          'timestamp' => REQUEST_TIME,
+        ))
+        ->expression('daycount', 'daycount + 1')
+        ->expression('totalcount', 'totalcount + 1')
+        ->execute();
+    }
+  }
+  if (!empty($statistics_enable_access_log)) {
     drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION);
 
     // For anonymous users unicode.inc will not have been loaded.
@@ -230,20 +252,21 @@ function statistics_user_predelete($account) {
  * Implements hook_cron().
  */
 function statistics_cron() {
-  $statistics_timestamp = variable_get('statistics_day_timestamp', '');
+  $config = config('statistics.settings');
+  $statistics_timestamp = $config->get('statistics_day_timestamp');
 
   if ((REQUEST_TIME - $statistics_timestamp) >= 86400) {
     // Reset day counts.
     db_update('node_counter')
       ->fields(array('daycount' => 0))
       ->execute();
-    variable_set('statistics_day_timestamp', REQUEST_TIME);
+    $config->set('statistics_day_timestamp', REQUEST_TIME)->save();
   }
 
   // Clean up expired access logs (if applicable).
-  if (variable_get('statistics_flush_accesslog_timer', 259200) > 0) {
+  if ($config->get('statistics_flush_accesslog_timer') > 0) {
     db_delete('accesslog')
-      ->condition('timestamp', REQUEST_TIME - variable_get('statistics_flush_accesslog_timer', 259200), '<')
+      ->condition('timestamp', REQUEST_TIME - config('statistics.settings')->get('statistics_flush_accesslog_timer'), '<')
       ->execute();
   }
 }
@@ -311,8 +334,8 @@ function statistics_get($nid) {
  */
 function statistics_block_info() {
   $blocks = array();
-
-  if (variable_get('statistics_count_content_views', 0)) {
+  $statistics_count_content_views = config('statistics.settings')->get('statistics_count_content_views');
+  if (!empty($statistics_count_content_views)) {
     $blocks['popular']['info'] = t('Popular content');
     // Too dynamic to cache.
     $blocks['popular']['cache'] = DRUPAL_NO_CACHE;
@@ -325,10 +348,11 @@ function statistics_block_info() {
  */
 function statistics_block_configure($delta = '') {
   // Popular content block settings
+  $config = config('statistics.settings');
   $numbers = array('0' => t('Disabled')) + drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40));
-  $form['statistics_block_top_day_num'] = array('#type' => 'select', '#title' => t("Number of day's top views to display"), '#default_value' => variable_get('statistics_block_top_day_num', 0), '#options' => $numbers, '#description' => t('How many content items to display in "day" list.'));
-  $form['statistics_block_top_all_num'] = array('#type' => 'select', '#title' => t('Number of all time views to display'), '#default_value' => variable_get('statistics_block_top_all_num', 0), '#options' => $numbers, '#description' => t('How many content items to display in "all time" list.'));
-  $form['statistics_block_top_last_num'] = array('#type' => 'select', '#title' => t('Number of most recent views to display'), '#default_value' => variable_get('statistics_block_top_last_num', 0), '#options' => $numbers, '#description' => t('How many content items to display in "recently viewed" list.'));
+  $form['statistics_block_top_day_num'] = array('#type' => 'select', '#title' => t("Number of day's top views to display"), '#default_value' => $config->get('statistics_block_top_day_num'), '#options' => $numbers, '#description' => t('How many content items to display in "day" list.'));
+  $form['statistics_block_top_all_num'] = array('#type' => 'select', '#title' => t('Number of all time views to display'), '#default_value' => $config->get('statistics_block_top_all_num'), '#options' => $numbers, '#description' => t('How many content items to display in "all time" list.'));
+  $form['statistics_block_top_last_num'] = array('#type' => 'select', '#title' => t('Number of most recent views to display'), '#default_value' => $config->get('statistics_block_top_last_num'), '#options' => $numbers, '#description' => t('How many content items to display in "recently viewed" list.'));
   return $form;
 }
 
@@ -336,9 +360,11 @@ function statistics_block_configure($delta = '') {
  * Implements hook_block_save().
  */
 function statistics_block_save($delta = '', $edit = array()) {
-  variable_set('statistics_block_top_day_num', $edit['statistics_block_top_day_num']);
-  variable_set('statistics_block_top_all_num', $edit['statistics_block_top_all_num']);
-  variable_set('statistics_block_top_last_num', $edit['statistics_block_top_last_num']);
+  $config = config('statistics.settings');
+  $config->set('statistics_block_top_day_num', $edit['statistics_block_top_day_num']);
+  $config->set('statistics_block_top_all_num', $edit['statistics_block_top_all_num']);
+  $config->set('statistics_block_top_last_num', $edit['statistics_block_top_last_num']);
+  $config->save();
 }
 
 /**
@@ -347,20 +373,21 @@ function statistics_block_save($delta = '', $edit = array()) {
 function statistics_block_view($delta = '') {
   if (user_access('access content')) {
     $content = array();
+    $config = config('statistics.settings');
 
-    $daytop = variable_get('statistics_block_top_day_num', 0);
+    $daytop = $config->get('statistics_block_top_day_num');
     if ($daytop && ($result = statistics_title_list('daycount', $daytop)) && ($node_title_list = node_title_list($result, t("Today's:")))) {
       $content['top_day'] = $node_title_list;
       $content['top_day']['#suffix'] = '<br />';
     }
 
-    $alltimetop = variable_get('statistics_block_top_all_num', 0);
+    $alltimetop = $config->get('statistics_block_top_all_num');
     if ($alltimetop && ($result = statistics_title_list('totalcount', $alltimetop)) && ($node_title_list = node_title_list($result, t('All time:')))) {
       $content['top_all'] = $node_title_list;
       $content['top_all']['#suffix'] = '<br />';
     }
 
-    $lasttop = variable_get('statistics_block_top_last_num', 0);
+    $lasttop = $config->get('statistics_block_top_last_num');
     if ($lasttop && ($result = statistics_title_list('timestamp', $lasttop)) && ($node_title_list = node_title_list($result, t('Last viewed:')))) {
       $content['top_last'] = $node_title_list;
       $content['top_last']['#suffix'] = '<br />';
@@ -423,7 +450,8 @@ function statistics_node_predelete(Node $node) {
  * Implements hook_ranking().
  */
 function statistics_ranking() {
-  if (variable_get('statistics_count_content_views', 0)) {
+  $statistics_count_content_views = config('statistics.settings')->get('statistics_count_content_views');
+  if (!empty($statistics_count_content_views)) {
     return array(
       'views' => array(
         'title' => t('Number of views'),
diff --git a/core/modules/statistics/statistics.test b/core/modules/statistics/statistics.test
index bb28b01..f742b64 100644
--- a/core/modules/statistics/statistics.test
+++ b/core/modules/statistics/statistics.test
@@ -33,8 +33,10 @@ class StatisticsTestCase extends WebTestBase {
     $this->drupalLogin($this->blocking_user);
 
     // Enable access logging.
-    variable_set('statistics_enable_access_log', 1);
-    variable_set('statistics_count_content_views', 1);
+    $config = config('statistics.settings');
+    $config->set('statistics_enable_access_log', 1);
+    $config->set('statistics_count_content_views', 1);
+    $config->save();
 
     // Insert dummy access by anonymous user into access log.
     db_insert('accesslog')
@@ -70,6 +72,12 @@ class StatisticsLoggingTestCase extends WebTestBase {
   function setUp() {
     parent::setUp(array('statistics', 'block'));
 
+    // Enable access logging.
+    $config = config('statistics.settings');
+    $config->set('statistics_enable_access_log', 1);
+    $config->set('statistics_count_content_views', 1);
+    $config->save();
+
     // Create Basic page node type.
     if ($this->profile != 'standard') {
       $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
@@ -85,10 +93,6 @@ class StatisticsLoggingTestCase extends WebTestBase {
     $config->set('cache', 1);
     $config->save();
 
-    // Enable access logging.
-    variable_set('statistics_enable_access_log', 1);
-    variable_set('statistics_count_content_views', 1);
-
     // Clear the logs.
     db_truncate('accesslog');
     db_truncate('node_counter');
@@ -363,8 +367,9 @@ class StatisticsAdminTestCase extends WebTestBase {
    * Verifies that the statistics settings page works.
    */
   function testStatisticsSettings() {
-    $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.'));
+    $config = config('statistics.settings');
+    $this->assertFalse($config->get('statistics_enable_access_log'), t('Access log is disabled by default.'));
+    $this->assertFalse($config->get('statistics_count_content_views'), t('Count content view log is disabled by default.'));
 
     $this->drupalGet('admin/reports/pages');
     $this->assertRaw(t('No statistics available.'), t('Verifying text shown when no statistics is available.'));
@@ -373,8 +378,8 @@ class StatisticsAdminTestCase extends WebTestBase {
     $edit['statistics_enable_access_log'] = 1;
     $edit['statistics_count_content_views'] = 1;
     $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.'));
+    $this->assertTrue(config('statistics.settings')->get('statistics_enable_access_log'), t('Access log is enabled.'));
+    $this->assertTrue(config('statistics.settings')->get('statistics_count_content_views'), t('Count content view log is enabled.'));
 
     // Hit the node.
     $this->drupalGet('node/' . $this->test_node->nid);
@@ -404,7 +409,7 @@ class StatisticsAdminTestCase extends WebTestBase {
    * Tests that when a node is deleted, the node counter is deleted too.
    */
   function testDeleteNode() {
-    variable_set('statistics_count_content_views', 1);
+    config('statistics.settings')->set('statistics_count_content_views', 1)->save();
 
     $this->drupalGet('node/' . $this->test_node->nid);
     // Manually calling statistics.php, simulating ajax behavior.
@@ -436,7 +441,7 @@ class StatisticsAdminTestCase extends WebTestBase {
    * Tests that accesslog reflects when a user is deleted.
    */
   function testDeleteUser() {
-    variable_set('statistics_enable_access_log', 1);
+    config('statistics.settings')->set('statistics_enable_access_log', 1)->save();
 
     variable_set('user_cancel_method', 'user_cancel_delete');
     $this->drupalLogout($this->privileged_user);
@@ -467,10 +472,12 @@ class StatisticsAdminTestCase extends WebTestBase {
    * Tests that cron clears day counts and expired access logs.
    */
   function testExpiredLogs() {
-    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);
+    $config = config('statistics.settings');
+    $config->set('statistics_enable_access_log', 1);
+    $config->set('statistics_count_content_views', 1);
+    $config->set('statistics_day_timestamp', 8640000);
+    $config->set('statistics_flush_accesslog_timer', 1);
+    $config->save();
 
     $this->drupalGet('node/' . $this->test_node->nid);
     // Manually calling statistics.php, simulating ajax behavior.
