Why a customized page list block shows less pages than it should?

Permalink
I customized the page_list view.php inside my template. Now, it works right, paginates and everything... but the first page shows only 5 pages instead of 9, as it's supposed to do. If you navigate to page 2 and 3 it correctly shows 9 elements.

Is there any known issue about this?

This is the code:

<?php
defined('C5_EXECUTE') or die("Access Denied.");
$rssUrl = $showRss ? $controller->getRssUrl($b) : '';
$th = Loader::helper('text');
$ih = Loader::helper('image');
?>
<div class="ccm-page-list">
   <?php foreach ($pages as $page):
      // Prepare data for each page being listed...
      $title = $th->entities($page->getCollectionName());
      $url = $nh->getLinkToCollection($page);
      $target = ($page->getCollectionPointerExternalLink() != '' && $page->openCollectionPointerExternalLinkInNewWindow()) ? '_blank' : $page->getAttribute('nav_target');
      $target = empty($target) ? '_self' : $target;
      $description = $page->getCollectionDescription();
      $description = $controller->truncateSummaries ? $th->wordSafeShortText($description, $controller->truncateChars) : $description;

avalentini
 
Deladroid replied on at Permalink Reply
Deladroid
Ironically I'm having this same issue. Are you skipping pages in a conditional loop past this code you posted?

This has given me a headache, but I think I've narrowed it down to the "Number of pages to show" count getting skewed when you conditionally skip pages in a loop in the view.php file, as it uses the $pages array as the total count.

This seem possible in your situation too?