Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8227783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:14:36+00:00 2026-06-07T16:14:36+00:00

this should be really simple but I can just not figure it out at

  • 0

this should be really simple but I can just not figure it out at the moment – I have searched and can’t find the right helping – maybe it’s my wording of my problem which is the issue – I know this is simple but as I have said I am brain dead at the moment!

this is what I want
Displaying 1 - 7 of 21 items

if there are 21 products in total with 7 per page it needs to say

1 – 7 of 21 on page one
8 – 14 of 21 on page two
15 – 21 of 21 on page three

pretty sure that is the right way to step up? anyway any help would be appreciated! and I can put a bounty on this – although small at least it’s something! thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:14:38+00:00Added an answer on June 7, 2026 at 4:14 pm

    If you know what page you’re on, and the number of entries per page, you can calculate it:

    $limit = 7;
    $page = 2;
    $total = 21;
    
    $upper = min( $total, $page * $limit);
    $lower = ($page - 1) * $limit + 1;
    printf( "Displaying %d - %d of %d on Page %d\n", $lower, $upper, $total, $page);
    

    Now, just loop over pages 1 – 3 to see the outputCodepad:

    Displaying 1 - 7 of 21 on Page 1
    Displaying 8 - 14 of 21 on Page 2
    Displaying 15 - 21 of 21 on Page 3
    

    Edit: Using the OP’s variables:

    $upper = min( $products_total, $pager_current * $limit);
    $lower = ($pager_current - 1) * $limit + 1;
    printf( "Displaying %d - %d of %d on Page %d\n", $lower, $upper, $products_total, $pager_current);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This problem is very simple, but I just can't figure it out added to
This should have a simple solution, but I can't seem to find it. I
This should be really simple, but I have tried many solutions posted on the
This seems like it should be really simple, but I'm unable to figure this
This really shouldn't be hard, I just can't figure out how to do it.
This question can be very simple but could not find the answer; I receive
This seems like it should be really easy but I couln't find an answer
This should be really simple. If I have a String like this: ../Test?/sample*.txt then
This should be really simple but for some reason I'm stumped on this... I'm
I know this question should be really simple, but for some reason thoroughly understanding

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.