[BUGFIX] Calculate count of records instead of using a query 47/57347/2
authorGeorg Ringer <georg.ringer@gmail.com>
Sat, 23 Jun 2018 17:32:08 +0000 (19:32 +0200)
committerJigal van Hemert <jigal.van.hemert@typo3.org>
Sat, 23 Jun 2018 19:22:26 +0000 (21:22 +0200)
Calculate the count of records within the code instead of using a
query which is conceptionally wrong using limit and offset.

Resolves: #85359
Releases: master
Change-Id: I5b4356fb860b73d64585f28a3bd4384a7884715a
Reviewed-on: https://review.typo3.org/57347
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: David Bruchmann <davidbruchmann@gmail.com>
Tested-by: David Bruchmann <davidbruchmann@gmail.com>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php

index 0acccfe..331d739 100644 (file)
@@ -1106,11 +1106,14 @@ class DatabaseRecordList
                 if ($this->csvOutput) {
                     $this->showLimit = $this->totalItems;
                     $this->iLimit = $this->totalItems;
+                    $dbCount = $this->totalItems;
+                } else {
+                    if ($this->firstElementNumber + $this->showLimit <= $this->totalItems) {
+                        $dbCount = $this->showLimit + 2;
+                    } else {
+                        $dbCount = $this->totalItems - $this->firstElementNumber + 2;
+                    }
                 }
-                $dbCount = $queryBuilder
-                    ->count('uid')
-                    ->execute()
-                    ->fetchColumn(0);
             }
         }
         // If any records was selected, render the list: