Skip to content

Commit

Permalink
Update Utility.php
Browse files Browse the repository at this point in the history
Fix usage of items per page configuration of pagination
  • Loading branch information
tbsschmdt authored Mar 25, 2024
1 parent 56dfc92 commit 4b96d34
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Classes/Utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use Sng\AdditionalReports\Pagination\SimplePagination;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
Expand Down Expand Up @@ -1200,7 +1201,14 @@ public static function isComposerMode(): bool
public static function buildPagination(array $items, int $currentPage, &$view): void
{
if (count($items) > 0) {
$itemsPerPage = 10;
try {
$itemsPerPage = (int)GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('additional_reports', 'itemsPerPage');
if ($itemsPerPage < 1) {
$itemsPerPage = 10;
}
} catch (\Exception $e) {
$itemsPerPage = 10;
}
$paginator = new ArrayPaginator($items, $currentPage, $itemsPerPage);
$pagination = new SimplePagination($paginator);
$pagination->generate();
Expand Down

0 comments on commit 4b96d34

Please sign in to comment.