Bug #85585
closedFluid's widget.paginate view helper does not respect limit on last page
100%
Description
f:widget.paginate
always fetches $itemsPerPage
on the last page of a paginated query result.
If there are e.g. 30 total records and the query result is limited to to 21 ($query->setLimit(21);
in the repository) will produce 3 pages (using the default itemsPerPage = 10
setting).
Expected behavior: Page 3 only lists record 21
Current behavior: Page 3 lists record 21 to 30
TYPO3 8.7 https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_8-7/typo3/sysext/fluid/Classes/ViewHelpers/Widget/Controller/PaginateController.php#L100
TYPO3 9.x master https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/fluid/Classes/ViewHelpers/Widget/Controller/PaginateController.php#L100
Updated by Guido Schmechel over 6 years ago
I can confirm it.
prepareObjectsSlice starts a new query and don't look at the maximum. It just calculate with itemsPerPage (default 10) and offset (default 10) This only affects if it is a QueryResultInterface.
If you assign $result->toArray() it is calculated correctly. I will provide a patch later.
Updated by Gerrit Code Review over 6 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57650
Updated by Gerrit Code Review over 6 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57650
Updated by Gerrit Code Review about 6 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57650
Updated by Guido Schmechel about 6 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 7b97335fc4e611f04c936531de87f4515c3b9ff9.