*/
error_reporting(E_ALL);
$login_required = FALSE;
include_once "web/includes/page.php";
include_once "web/Widgets/ViewTracker/ViewTracker.php";
$type = NULL;
if (!empty($_GET['type'])) {
    $type = htmlspecialchars($_GET['type']);
}
$error = NULL;
$view_content = array();
//fetching the data according to view count.
$obj = new ViewTracker();
try {
    $obj->set_type($type);
    $view_content = $obj->get_most_viewed_pages();
} catch (PAException $e) {
    $error = '<li>' . $e->message . '</li>';
}
$html = '<ul>';
if (!empty($view_content)) {
    foreach ($view_content as $value) {
        if (!empty($value->title)) {
            $html .= '<li><a href= "' . $value->url . '">' . $value->title . '</a></li>';
        }
    }
} else {
    $html .= $error;
}
$html .= '</ul>';
//creating the rss