<?php
include('include/autoloader.php');
if (isset($_SESSION['media_cms_user'])) {
$ur = explode('?',curPageURL());
if (count($ur) != 0) {
if (isset($ur[1])) {
parse_str($ur[1],$q);	
}
}

$page = 1;
if (isset($options['theme_user_lists_number'])) {
	$size = $options['theme_user_lists_number'];
} else {
	$size = 24;
}
if (isset($q['page'])){ $page = (int) $q['page']; }
$sqls = "SELECT * FROM lists WHERE user_id='$_SESSION[media_cms_user]'";
$query = $mysqli->query($sqls);
$total_records = $query->num_rows;
$smarty->assign('total_records',$total_records);
if ($total_records > 0) {
$pagination = new Pagination();
$pagination->setLink("./user/lists?page=%s");
$pagination->setPage($page);
$pagination->setSize($size);
$pagination->setTotalRecords($total_records);
$get = "SELECT * FROM lists WHERE user_id='$_SESSION[media_cms_user]' ORDER BY create_datetime DESC ".$pagination->getLimitSql();
$qu = $mysqli->query($get);
while ($rows = $qu->fetch_assoc()) {
	$lists[] = $rows;
}
$smarty->assign('lists',$lists);
$smarty->assign('pagi',$pagination->create_links());
}

}
$smarty->assign('seo_title',$language['my_lists'].' - '.$options['general_seo_title']);
$smarty->assign('seo_keywords',$options['general_seo_keywords']);
$smarty->assign('seo_description',$options['general_seo_description']);
$smarty->display('user-lists.html');
?>