Make WordPress Core

Ticket #16187: 16187.002.diff

File 16187.002.diff, 1.3 KB (added by markjaquith, 14 years ago)
  • wp-admin/includes/class-wp-list-table.php

     
    436436        function get_pagenum() {
    437437                $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
    438438
     439                if( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] )
     440                        $pagenum = $this->_pagination_args['total_pages'];
     441               
    439442                return max( 1, $pagenum );
    440443        }
    441444
  • wp-admin/upload.php

     
    1313        wp_die( __( 'You do not have permission to upload files.' ) );
    1414
    1515$wp_list_table = get_list_table('WP_Media_List_Table');
     16$pagenum = $wp_list_table->get_pagenum();
    1617
    1718// Handle bulk actions
    1819$doaction = $wp_list_table->current_action();
     
    129130
    130131$wp_list_table->prepare_items();
    131132
     133$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
     134if ( $pagenum > $total_pages && $total_pages > 0 ) {
     135        wp_redirect( add_query_arg( 'paged', $total_pages ) );
     136        exit;
     137}
     138
    132139$title = __('Media Library');
    133140$parent_file = 'upload.php';
    134141