/**
  * Handles data query and filter, sorting, and pagination.
  *
  */
 public function prepare_items()
 {
     $columns = $this->get_columns();
     $hidden = array();
     $sortable = $this->get_sortable_columns();
     $type = array_key_exists('type', $_REQUEST) ? $_REQUEST['type'] : null;
     /** Process headers */
     $this->_column_headers = array($columns, $hidden, $sortable);
     /** Process bulk action */
     $this->process_bulk_action();
     /** Pagination */
     $per_page = $this->per_page;
     $types = $type ? array($type) : [];
     $current_page = $this->get_pagenum();
     $offset = ($current_page - 1) * $per_page;
     $this->total_posts = $this->admin->count_smmp_posts();
     $this->set_pagination_args(['total_items' => $this->total_posts, 'per_page' => $per_page]);
     /* Get & format posts */
     $smmps = $this->admin->get_all_smmp_posts($types, $offset, $per_page, 'ARRAY_A');
     $smmps = $this->add_posts_content($smmps);
     $this->items = (array) $smmps;
 }