Title: Pagination bug fixed
Last modified: August 19, 2016

---

# Pagination bug fixed

 *  [wrk](https://wordpress.org/support/users/wrk/)
 * (@wrk)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/pagination-bug-fixed/)
 * Hey Alex,
 * I found a problem with the pagination in manage-galleries.php.
 * Displaying a – b of n was not working properly,
 * I changed the code around line 139 from:
 *     ```
       <?php if ( $page_links ) : ?>
         <div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s',
         number_format_i18n( ( $_GET['paged'] - 1 ) * $nggdb->paged['objects_per_page'] + 1 ),
         number_format_i18n( min( $_GET['paged'] * $nggdb->paged['objects_per_page'], $nggdb->paged['total_objects'] ) ),
         number_format_i18n( $nggdb->paged['total_objects'] ),
         $page_links
       ); echo $page_links_text; ?></div>
       <?php endif; ?>
       ```
   
 * to:
 *     ```
       <?php if ( $page_links ) : ?>
         <div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s',
         number_format_i18n( ($_GET['paged'] == $rrodb->paged['max_objects_per_page']) ?  $rrodb->paged['total_objects'] - $rrodb->paged['objects_per_page']  : (( $_GET['paged'] - 1 ) * $rrodb->paged['objects_per_page']) + 1 ),
         number_format_i18n( $_GET['paged'] == $rrodb->paged['max_objects_per_page'] ? $rrodb->paged['total_objects'] : $_GET['paged'] * $rrodb->paged['objects_per_page'] ),
         number_format_i18n( $rrodb->paged['total_objects'] ),
         $page_links
         ); echo $page_links_text; ?></div>
       <?php endif; ?>
       ```
   
 * Cheers,
    Vincent

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Alex Rabe](https://wordpress.org/support/users/alexrabe/)
 * (@alexrabe)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/pagination-bug-fixed/#post-1436592)
 * Thanks Vincent,
 * under which condition does the pagination fail ?
 *  Thread Starter [wrk](https://wordpress.org/support/users/wrk/)
 * (@wrk)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/pagination-bug-fixed/#post-1436694)
 * hey alex,
 * let say i I have **30** galleries to list with a **max of 25/page**.
 * for the 1st page the pagination gives: **Displaying 1–25 of 30** (thats correct)
 * for the 2nd (last page) the pagination gives: **Displaying 6–10 of 30** (thats
   incorrect..)
 * I also tested it with other max numbers/page and same story again.
 * The changes i posted above fixed the problem for me!
 *  [Alex Rabe](https://wordpress.org/support/users/alexrabe/)
 * (@alexrabe)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/pagination-bug-fixed/#post-1436781)
 * Ok, this should be the fix for that :
 * [http://code.google.com/p/nextgen-gallery/source/detail?r=725](http://code.google.com/p/nextgen-gallery/source/detail?r=725)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Pagination bug fixed’ is closed to new replies.

 * 3 replies
 * 2 participants
 * Last reply from: [Alex Rabe](https://wordpress.org/support/users/alexrabe/)
 * Last activity: [16 years, 1 month ago](https://wordpress.org/support/topic/pagination-bug-fixed/#post-1436781)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
