Skip to content

Commit

Permalink
Fixed count of emails doubled by page.
Browse files Browse the repository at this point in the history
  • Loading branch information
No3x committed Sep 30, 2014
1 parent e2389f8 commit a263800
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions WPML_Email_Log_List.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ function prepare_items() {
$per_page = $this->get_items_per_page( 'per_page', 25 );
$current_page = $this->get_pagenum();
$total_items = $wpdb->get_var( "SELECT COUNT(*) FROM `$tableName`" );
$limit = $per_page*$current_page;

//TODO: make option for default order
$orderby_default = "mail_id";
$order_default = "desc";
$orderby = ( !empty( $_GET['orderby'] ) ) ? $_GET['orderby'] : $orderby_default;
$order = ( !empty($_GET['order'] ) ) ? $_GET['order'] : $order_default;
$offset = ( $current_page-1 ) * $per_page;

$dataset = $wpdb->get_results( "SELECT * FROM `$tableName` ORDER BY $orderby $order LIMIT $limit OFFSET $offset", ARRAY_A);
$dataset = $wpdb->get_results( "SELECT * FROM `$tableName` ORDER BY $orderby $order LIMIT $per_page OFFSET $offset", ARRAY_A);

$this->set_pagination_args( array(
'total_items' => $total_items, // the total number of items
Expand Down

0 comments on commit a263800

Please sign in to comment.