Skip to content
Snippets Groups Projects
Commit 92d7a47d authored by Fabian Galinski's avatar Fabian Galinski :pouting_cat:
Browse files

[BUGFIX] The previous duplicate news entries bugfix was just working for 66%

parent fda21e41
No related branches found
No related tags found
No related merge requests found
......@@ -102,7 +102,7 @@ class ListByCategoryController extends AbstractController {
$numberOfPages = ($newsPerPage <= 0 ? 0 : ceil($newsCount / $newsPerPage));
$headerSet = FALSE;
$offset = $this->calculatePaginationOffset($currentPageBrowserPage);
$offset = $this->calculatePaginationOffset($currentPageBrowserPage, $newsPerPage);
$news = $this->newsRepository->findAllSortedNewsByCategories(
$categoryUids, $newsPerPage, $offset, $this->settings['sortBy'], $tagUids, $startTime, $endTime
......
......@@ -239,7 +239,7 @@ class OverviewController extends AbstractController {
$newsCount = $this->newsRepository->newsCountByCategories($categoryIds, $tagIds, $startTime, $endTime);
$numberOfPages = ($newsLimitPerCategory <= 0 ? 0 : ceil($newsCount / $newsLimitPerCategory));
// Redo this function, until one variable get the amount of newsLimitPerTag. Reduces the amount of ajax calls. Needed because of languagevisibility.
if ($maxNewsPerCategory < $newsLimitPerCategory && count($allNews) < $newsLimitPerCategory) {
if ($maxNewsPerCategory < $newsLimitPerCategory && \count($allNews) < $newsLimitPerCategory) {
$nextPage = $currentPageBrowserPage + 1;
if ($nextPage <= $numberOfPages) {
$this->setPageBrowserPage($nextPage);
......@@ -445,13 +445,11 @@ class OverviewController extends AbstractController {
$this->view->assign('selectedTag', $selectedTag);
$this->view->assign('selectedCategory', $selectedCategory);
$offset = $this->calculatePaginationOffset($currentPageBrowserPage);
$newsPerPage = (int) $this->settings['newsLimit'];
$offset = $this->calculatePaginationOffset($currentPageBrowserPage, $newsPerPage);
$startTime = (int) $this->settings['starttime'];
$endTime = (int) $this->settings['endtime'];
if ($this->settings['onlyNewsWithinThisPageSection']) {
/** @noinspection PhpUndefinedMethodInspection */
$categories = $this->categoryRepository->findByPid($GLOBALS['TSFE']->id);
......@@ -511,7 +509,7 @@ class OverviewController extends AbstractController {
$numberOfPages = ($newsPerPage <= 0 ? 0 : ceil($newsCount / $newsPerPage));
// Redo this function, until one variable get the amount of newsLimitPerTag. Reduces the amount of ajax calls. Needed because of languagevisibility.
if (count($newsMetaData) < $newsPerPage) {
if (\count($newsMetaData) < ($newsPerPage - 1)) {
$nextPage = $currentPageBrowserPage + 1;
if ($nextPage <= $numberOfPages) {
$this->setPageBrowserPage($nextPage);
......@@ -542,10 +540,6 @@ class OverviewController extends AbstractController {
* @return void
*/
protected function setPageBrowserPage($newPage) {
if (!isset($_GET['tx_sgnews_pagebrowser']['currentPage'])) {
return;
}
$_GET['tx_sgnews_pagebrowser']['currentPage'] = $newPage;
}
}
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