Forums

Pagination bug fixed (4 posts)

  1. wrk
    Member
    Posted 2 years ago #

    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

  2. Alex Rabe
    Member
    Posted 2 years ago #

    Thanks Vincent,

    under which condition does the pagination fail ?

  3. wrk
    Member
    Posted 2 years ago #

    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!

  4. Alex Rabe
    Member
    Posted 2 years ago #

    Ok, this should be the fix for that :

    http://code.google.com/p/nextgen-gallery/source/detail?r=725

Topic Closed

This topic has been closed to new replies.

About this Topic