if (isset($_REQUEST['pg']) && is_numeric($_REQUEST['pg'])) {
    $current_page = intval($_REQUEST['pg']);
}
$filter = NULL;
if (isset($_REQUEST['filter']) && $_REQUEST['filter'] != '') {
    $filter = $_REQUEST['filter'];
}
if (!($section = $DB->fetchRow(0, "SELECT * FROM `tbl_sections` WHERE `id` = '" . intval($_REQUEST['_sid']) . "' LIMIT 1"))) {
    $Admin->fatalError("Unknown Section", "<p>The Section you are looking for could not be found.</p>", true, true);
}
$section_id = intval($section['id']);
$section_primary_field = $section['primary_field'];
$GLOBALS['pageTitle'] = $section['name'];
$sql = "SELECT * " . "FROM tbl_authors " . "ORDER BY username ASC";
$authors = $DB->fetch($sql);
list($entry_count_total, $entry_count_remaining, $entries) = $entryManager->fetchEntriesByPage($section_id, $current_page, $Admin->getConfigVar('pagination_maximum_rows', 'symphony'), $filter);
$sql = "SELECT t2.*\n\t\t\tFROM `tbl_sections_visible_columns` as t1\n\t\t\tLEFT JOIN `tbl_customfields` as t2 ON t1.field_id = t2.id\n\t\t\tWHERE t1.section_id = {$section_id}\n\t\t\tORDER BY t2.sortorder ASC\n\t\t\t";
$result = $DB->fetch($sql);
$columns = array();
if (is_array($result) && !empty($result)) {
    foreach ($result as $r) {
        $columns[] = array("title" => $r['name'], "field_id" => $r['id']);
    }
}
if ($section['author_column'] == 'show') {
    $columns[] = array("title" => 'Author', "field_id" => NULL);
}
if ($section['date_column'] == 'show') {
    $columns[] = array("title" => 'Date Published', "field_id" => NULL);
}
if ($section['commenting'] == 'on') {