diff --git a/config/global.ini.php b/config/global.ini.php
index 932b50069e690d6ec4e4cb3f5e5bc324a66b776e..c01f512adbe6dbcd74014b5251c75ddde6b86b6b 100644
--- a/config/global.ini.php
+++ b/config/global.ini.php
@@ -228,11 +228,15 @@ feedback_email_address = "hello@piwik.org"
 
 ; during archiving, Piwik will limit the number of results recorded, for performance reasons
 ; maximum number of rows for any of the Referers tables (keywords, search engines, campaigns, etc.)
-; this limit will also be applied to the Custom Variables names and values reports
 datatable_archiving_maximum_rows_referers = 1000
 ; maximum number of rows for any of the Referers subtable (search engines by keyword, keyword by campaign, etc.)
 datatable_archiving_maximum_rows_subtable_referers = 50
 
+; maximum number of rows for the Custom Variables names report
+datatable_archiving_maximum_rows_custom_variables = 1000
+; maximum number of rows for the Custom Variables values reports
+datatable_archiving_maximum_rows_subtable_custom_variables = 1000
+
 ; maximum number of rows for any of the Actions tables (pages, downloads, outlinks)
 datatable_archiving_maximum_rows_actions = 500
 ; maximum number of rows for pages in categories (sub pages, when clicking on the + for a page category)
diff --git a/plugins/CustomVariables/Archiving.php b/plugins/CustomVariables/Archiving.php
index e9ca547707b08bd22e4e789ae761ed3457e1ab98..166d8c912480a6c283296bcf3888d59f1d4d96a3 100644
--- a/plugins/CustomVariables/Archiving.php
+++ b/plugins/CustomVariables/Archiving.php
@@ -21,9 +21,8 @@ class Piwik_CustomVariables_Archiving
 
     function __construct()
     {
-        //TODO FIX
-        $this->maximumRowsInDataTableLevelZero = Piwik_Config::getInstance()->General['datatable_archiving_maximum_rows_referers'];
-        $this->maximumRowsInSubDataTable = Piwik_Config::getInstance()->General['datatable_archiving_maximum_rows_subtable_referers'];
+        $this->maximumRowsInDataTableLevelZero = Piwik_Config::getInstance()->General['datatable_archiving_maximum_rows_custom_variables'];
+        $this->maximumRowsInSubDataTable = Piwik_Config::getInstance()->General['datatable_archiving_maximum_rows_subtable_custom_variables'];
     }
 
     public function archiveDay(Piwik_ArchiveProcessing_Day $archiveProcessing)
@@ -32,7 +31,6 @@ class Piwik_CustomVariables_Archiving
 
         $table = $archiveProcessing->getDataTableWithSubtablesFromArraysIndexedByLabel($this->metricsByKeyAndValue, $this->metricsByKey);
 
-
         $blob = $table->getSerialized(
             $this->maximumRowsInDataTableLevelZero, $this->maximumRowsInSubDataTable,
             $columnToSort = Piwik_Archive::INDEX_NB_VISITS