WordPress.org

Make WordPress Core

Ticket #46346: wp-list-table-integer-total-pages.patch

File wp-list-table-integer-total-pages.patch, 705 bytes (added by lev0, 20 months ago)
  • wp-admin/includes/class-wp-list-table.php

    a b  
    283283                        )
    284284                );
    285285
    286                 if ( !$args['total_pages'] && $args['per_page'] > 0 )
    287                         $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
     286                if ( !$args['total_pages'] && $args['per_page'] > 0 ) {
     287                        $over = $args['total_items'] % $args['per_page'];
     288                        $args['total_pages'] = ( (bool) $over ) + ( ( $args['total_items'] - $over ) / $args['per_page'] );
     289                }
    288290
    289291                // Redirect if page number is invalid and headers are not already sent.
    290292                        if ( ! headers_sent() && ! wp_doing_ajax() && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {