diff --git a/lib/models/MvvFile.php b/lib/models/MvvFile.php
index b508b9a65aa840580ab6174ae2f15e846648371c..493fd0351fae81d41ffbe9289a2479eda12d17d9 100644
--- a/lib/models/MvvFile.php
+++ b/lib/models/MvvFile.php
@@ -175,9 +175,7 @@ class MvvFile extends ModuleManagementModel
             ['count_zuordnungen', 'mvv_files_filerefs.name', 'file_refs.name']
         );
 
-        $parameters = [
-            ':ranges' => self::getIdsFiltered($filter),
-        ];
+        $parameters = [];
 
         $name_filter_sql = '';
         if ($filter['searchnames']) {
@@ -186,6 +184,8 @@ class MvvFile extends ModuleManagementModel
         }
         unset($filter['searchnames']);
 
+        $parameters[':ranges'] = self::getIdsFiltered($filter);
+
         $query = "SELECT `mvv_files`.*,
                          COUNT(`mvv_files_ranges`.`range_id`) AS `count_relations`,
                          `file_refs`.`name` AS `filename`,