0

For example with a limit of 10 and a total number of entries of 18, page 1 (/foo/bar) should return 10 entries, page 2 (/foo/bar/P10) would receive 8, any other page (foo/bar/P20) should throw a 404.

0

you ready for this? I pray to crap that someone has a better answer but heeere we go...

Turn PHP on output for your form. At your template start, add this:

<?php $paginate = FALSE; ?>

Then, in your paginate loop set it to true:

{paginate}
    <?php $paginate = TRUE; ?>
    Pagination links and stuff and things...
{/paginate}

Then after your channel entries (or search or whatever loop) (this assumes segment_4 is your pagination segment):

<?php if (!$paginate) {

    if ("{segment_4}")
    {
    ?>
         {redirect="404"}
    <?php
    }
    ?>

<? } ?>

Next issue... This works, but not for a single paging number past your last result. So if P580 is your last pagination page, and you have 588 results, manually entering P588 works, P590 and up 404's, but P589 loads with a broken template display.

I have a solution for fixing that, but this train just keeps getting messier, so see probably what else you can do; this is a kind-of band-aid.

| improve this answer | |
0

AB Pagination has support for "Strict URLs" which will throw a 404 if you reach a page where there are no more entries: https://devot-ee.com/add-ons/ab-pagination

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.