diff --git a/core/DataAccess/Model.php b/core/DataAccess/Model.php
index <HASH>..<HASH> 100644
--- a/core/DataAccess/Model.php
+++ b/core/DataAccess/Model.php
@@ -282,8 +282,10 @@ class Model
     public function deletePreviousArchiveStatus($numericTable, $archiveId, $doneFlag)
     {
         $tableWithoutLeadingPrefix = $numericTable;
-        if (strlen($numericTable) >= 23) {
-            $tableWithoutLeadingPrefix = substr($numericTable, strlen($numericTable) - 23);
+        $lenNumericTableWithoutPrefix = strlen('archive_numeric_MM_YYYY');
+
+        if (strlen($numericTable) >= $lenNumericTableWithoutPrefix) {
+            $tableWithoutLeadingPrefix = substr($numericTable, strlen($numericTable) - $lenNumericTableWithoutPrefix);
             // we need to make sure lock name is less than 64 characters see https://github.com/piwik/piwik/issues/9131
         }
         $dbLockName = "rmPrevArchiveStatus.$tableWithoutLeadingPrefix.$archiveId";
removed the hardcoded <I> and instead calculate lenght dynamically