/**
  *
  */
 public function prepare_items()
 {
     $columns = $this->get_columns();
     $hidden = array();
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     $log_id = isset($_REQUEST['log_id']) ? esc_attr($_REQUEST['log_id']) : null;
     $msg_type = null;
     $object_id = null;
     $object_type = 'post';
     $log_status = null;
     $date_start = null;
     $date_end = null;
     $message = null;
     $storage_type = 'object';
     $log_data = Syndication_Logger::instance()->get_messages($log_id, $msg_type, $object_id, $object_type, $log_status, $date_start, $date_end, $message, $storage_type);
     foreach ($log_data as $site_id => $log_items) {
         $this->prepared_data = array_merge($this->prepared_data, $log_items);
     }
     usort($this->prepared_data, array($this, 'usort_reorder'));
     $per_page = $this->get_items_per_page('per_page');
     $current_page = $this->get_pagenum();
     $total_items = count($this->prepared_data);
     $this->found_data = array_slice($this->prepared_data, ($current_page - 1) * $per_page, $per_page);
     // Populate min/max dates.
     if ($this->found_data) {
         $items_sorted_by_time = $this->found_data;
         usort($items_sorted_by_time, function ($a, $b) {
             return strtotime($a['time']) - strtotime($b['time']);
         });
         $this->_max_date = strtotime(end($items_sorted_by_time)['time']);
         $this->_min_date = strtotime(reset($items_sorted_by_time)['time']);
     }
     // Filter by month
     $requested_month = isset($_REQUEST['month']) ? esc_attr($_REQUEST['month']) : null;
     if ($requested_month) {
         $this->found_data = array_filter($this->found_data, function ($item) use($requested_month) {
             return date('Y-m', strtotime($item['time'])) === $requested_month;
         });
     }
     // Filter by type
     $requested_type = isset($_REQUEST['type']) ? esc_attr($_REQUEST['type']) : null;
     if ($requested_type) {
         $this->found_data = array_filter($this->found_data, function ($item) use($requested_type) {
             return $requested_type === $item['msg_type'];
         });
     }
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page));
     $this->items = $this->found_data;
 }