<?
namespace admin\controls;
class Archive {
  static public function products_list() {

    $current_page = \S::get_session( 'archive_products_list_current_page' );

    if ( !$current_page ) {
      $current_page = 1;
      \S::set_session( 'archive_products_list_current_page', $current_page );
    }

    $query = \S::get_session( 'archive_products_list_query' );
    if ( $query ) {
      $query_array = [];
      parse_str( $query, $query_array );
    }

    return \Tpl::view( 'archive/products-list', [
      'current_page' => $current_page,
      'query_array' => $query_array,
      'pagination_max' => ceil( \admin\factory\ShopProduct::count_product() / 10 )
    ] );
  }
}