From 29e7e2827a960c500d2d65260b0aff26fc7acf98 Mon Sep 17 00:00:00 2001 From: Larry Garfield <larry@garfieldtech.com> Date: Thu, 21 Apr 2022 11:11:32 -0500 Subject: [PATCH] [BUGFIX] Only show pagination indicator if there are multiple pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The search results page currently may show the "pages" indicator in the title when there are no page numbers to show. This patch changes it to only show pagination information if there is information to show. Resolves: #96796 Releases: main, 11.5, 10.4 Change-Id: I8c1600a7eb732ed018c22bc02b0e689eb39a081c Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74938 Tested-by: core-ci <typo3@b13.com> Tested-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Stefan Bürk <stefan@buerk.tech> --- .../Classes/Controller/SearchController.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/typo3/sysext/indexed_search/Classes/Controller/SearchController.php b/typo3/sysext/indexed_search/Classes/Controller/SearchController.php index 623f502c23fe..0c9eaccbf8b7 100644 --- a/typo3/sysext/indexed_search/Classes/Controller/SearchController.php +++ b/typo3/sysext/indexed_search/Classes/Controller/SearchController.php @@ -475,11 +475,13 @@ class SearchController extends ActionController $resultData['CSSsuffix'] = ($specRowConf['CSSsuffix'] ?? false) ? '-' . $specRowConf['CSSsuffix'] : ''; if ($this->multiplePagesType($row['item_type'])) { $dat = json_decode($row['static_page_arguments'], true); - $pp = explode('-', $dat['key']); - if ($pp[0] != $pp[1]) { - $resultData['titleaddition'] = ', ' . LocalizationUtility::translate('result.pages', 'IndexedSearch') . ' ' . $dat['key']; - } else { - $resultData['titleaddition'] = ', ' . LocalizationUtility::translate('result.page', 'IndexedSearch') . ' ' . $pp[0]; + if (is_array($dat) && is_string($dat['key'] ?? null) && $dat['key'] !== '') { + $pp = explode('-', $dat['key']); + if ($pp[0] != $pp[1]) { + $resultData['titleaddition'] = ', ' . LocalizationUtility::translate('result.pages', 'IndexedSearch') . ' ' . $dat['key']; + } else { + $resultData['titleaddition'] = ', ' . LocalizationUtility::translate('result.page', 'IndexedSearch') . ' ' . $pp[0]; + } } } $title = $resultData['item_title'] . ($resultData['titleaddition'] ?? ''); -- GitLab