Skip to content
Snippets Groups Projects
Commit 77b92157 authored by Stefan Galinski's avatar Stefan Galinski :video_game:
Browse files

[TASK] Release of version 4.1.3, Disallow pagination pages greater than the...

[TASK] Release of version 4.1.3, Disallow pagination pages greater than the maximum allowed number of possible pages
parent ba110e65
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,7 @@ use SGalinski\SgJobs\Property\TypeConverter\UploadedFileReferenceConverter;
use SGalinski\SgMail\Service\MailTemplateService;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Http\ImmediateResponseException;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -45,6 +46,8 @@ use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Frontend\Controller\ErrorController;
use TYPO3\CMS\Frontend\Page\PageAccessFailureReasons;
/**
* The joblist plugin controller
......@@ -143,6 +146,8 @@ class JoblistController extends ActionController {
* @param int $currentPageBrowserPage
* @return void
* @throws \TYPO3\CMS\Core\Context\Exception\AspectNotFoundException
* @throws \TYPO3\CMS\Core\Error\Http\PageNotFoundException
* @throws ImmediateResponseException
*/
public function indexAction(array $filters = [], int $jobId = NULL, int $currentPageBrowserPage = 0): void {
if ($filters) {
......@@ -205,6 +210,16 @@ class JoblistController extends ActionController {
// get all jobs for the current page
$allJobs = $this->jobRepository->findJobsByFilter($filters)->toArray();
$numberOfPages = ($jobLimit <= 0 ? 0 : \ceil(\count($allJobs) / $jobLimit));
if ($currentPageBrowserPage >= $numberOfPages) {
/** @var ErrorController $errorController */
$errorController = GeneralUtility::makeInstance(ErrorController::class);
$response = $errorController->pageNotFoundAction(
$GLOBALS['TYPO3_REQUEST'],
'The requested page does not exist',
['code' => PageAccessFailureReasons::PAGE_NOT_FOUND]
);
throw new ImmediateResponseException($response);
}
}
$this->view->assign('jobs', $jobs);
......
......@@ -6,7 +6,7 @@
"license": [
"GPL-2.0-or-later"
],
"version": "4.1.2",
"version": "4.1.3",
"support": {
"issues": "https://gitlab.sgalinski.de/typo3/sg_jobs"
},
......
......@@ -4,7 +4,7 @@ $EM_CONF['sg_jobs'] = [
'title' => 'Jobs',
'description' => 'Manage and display your Job offers.',
'category' => 'plugin',
'version' => '4.1.2',
'version' => '4.1.3',
'state' => 'stable',
'uploadfolder' => FALSE,
'createDirs' => '',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment