From 2afd6eb74ab48d63c1254df77cca2e41eb1e8c28 Mon Sep 17 00:00:00 2001
From: Stefan Galinski <stefan@sgalinski.de>
Date: Mon, 8 May 2023 21:22:38 +0200
Subject: [PATCH] [BUGFIX] Fix possible PHP 8 warning with missing array key

---
 Classes/Controller/JoblistController.php | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/Classes/Controller/JoblistController.php b/Classes/Controller/JoblistController.php
index a2a8eec8..628f285f 100644
--- a/Classes/Controller/JoblistController.php
+++ b/Classes/Controller/JoblistController.php
@@ -73,7 +73,7 @@ use TYPO3\CMS\Frontend\Page\PageAccessFailureReasons;
  * The joblist plugin controller
  */
 class JoblistController extends ActionController {
-	// the array key for the error message in the post array
+	// the array key for the error message in the post-array
 	public const ERROR_KEY_IN_POST = 'error';
 
 	private const UPLOADED_FILES = [
@@ -170,8 +170,12 @@ class JoblistController extends ActionController {
 	 * Initialize the indexAction to set the currentPageBrowserPage parameter
 	 */
 	public function initializeIndexAction(): void {
-		$currentPageBrowserPage = GeneralUtility::_GP('tx_sgjobs_pagebrowser') ?
-			(int) GeneralUtility::_GP('tx_sgjobs_pagebrowser')['currentPage'] : 0;
+		$currentPageBrowserPage = 0;
+		$parameters = GeneralUtility::_GP('tx_sgjobs_pagebrowser');
+		if (is_array($parameters)) {
+			$currentPageBrowserPage = (int) $parameters['currentPage'] ?: 0;
+		}
+
 		if ($currentPageBrowserPage > 0) {
 			$this->request->setArgument('currentPageBrowserPage', $currentPageBrowserPage);
 		}
-- 
GitLab