$range_filter = "extract(month from ab_entry.creation) = " . $_REQUEST['m'] . " AND extract(year from ab_entry.creation) = " . $_REQUEST['y'];
    } else {
        $period = $_REQUEST['y'];
        $range_filter = "extract(year from ab_entry.creation) = " . $_REQUEST['y'];
    }
    $rows = $entrada->readDataFilter("ab_entry.public IS TRUE AND {$range_filter}");
    for ($i = 0; $i < count($rows); $i++) {
        $rows[$i]['seo_title'] = generate_seo_link($rows[$i]['ab_entry']);
        $rows[$i]['texto'] = strip_code($rows[$i]['texto']);
    }
    $smarty->assign('entradas', $rows);
    $smarty->assign('title', $period . ' &#8212; Archivo');
    $smarty->assign('period', $period);
    unset($rows);
    $smarty->assign('pgs', $pgs);
    $smarty->assign('pg', $pg);
    unset($rows);
    # Ultimas Entradas
    $entrada->readEnv();
    $entrada->limit = 10;
    $rows = $entrada->readDataFilter("public IS TRUE");
    $smarty->assign('ult_entradas', $rows);
    unset($rows);
    # Meses
    $rows = $entrada->readDataSQL("SELECT DISTINCT (extract(year from creation)||'-'||extract(month from creation)||'-01')::date AS mes FROM ab_entry WHERE public IS TRUE ORDER BY mes DESC");
    $smarty->assign('periodos', $rows);
    unset($rows);
    unset($var);
    unset($entrada);
}
$smarty->display($tpl, $pattern);