Make WordPress Core

Ticket #46346: corrected.patch

File corrected.patch, 811 bytes (added by lev0, 3 years ago)

wp-list-table-integer-total-pages corrected

  • wp-admin/includes/class-wp-list-table.php

    a b  
    284284               );
    285285
    286286               if ( ! $args['total_pages'] && $args['per_page'] > 0 ) {
    287                        $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
     287                       $remainder = $args['total_items'] % $args['per_page'];
     288                       if ( $remainder ) {
     289                               $args['total_pages'] = 1 + ( $args['total_items'] - $remainder ) / $args['per_page'];
     290                       } else {
     291                               $args['total_pages'] = $args['total_items'] / $args['per_page'];
     292                       }
    288293               }
    289294
    290295               // Redirect if page number is invalid and headers are not already sent.