Project

General

Profile

Actions

Bug #85585

closed

Fluid's widget.paginate view helper does not respect limit on last page

Added by Georg Tiefenbrunn over 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2018-07-18
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

Actions #1

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.

Actions #2

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

Actions #3

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

Actions #4

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

Actions #5

Updated by Guido Schmechel about 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #6

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF