function snippet_permalink($text = '%title%', $title = '%title%')
{
    global $db, $Cfg, $Weblogs, $Current_weblog;
    $link = make_archive_link() . "#e" . $db->entry['code'];
    $text = str_replace('%title%', snippet_title(), $text);
    $text = format_date($db->entry["date"], $text);
    $title = trim($title);
    if (!empty($title)) {
        $title = str_replace('%title%', snippet_title('strip'), $title);
        $title = format_date($db->entry["date"], $title);
    }
    $code = sprintf("<a href=\"%s%s\" title=\"%s\">%s</a>", $Weblogs[$Current_weblog]['ssi_prefix'], $link, $title, $text);
    return $code;
}
// Sort Order
if (!empty($_REQUEST['sort']) && !empty($_REQUEST['order'])) {
    $_REQUEST['sortorder'] = $_REQUEST['sort'] . '-' . $_REQUEST['order'];
}
// Snippet Price Range
if (!empty($_REQUEST['snippet']) && strpos(Http_Uri::getUri(), '/blog/') !== 0) {
    // Get Price Ranges
    $price_range = get_price_range($_REQUEST['price_range']);
    $_REQUEST['snip_minimum_price'] = $_REQUEST['minimum_price'];
    $_REQUEST['snip_maximum_price'] = $_REQUEST['maximum_price'];
    if (!empty($price_range['minimum_price']) || !empty($price_range['maximum_price'])) {
        $_REQUEST['minimum_price'] = $price_range['minimum_price'];
        $_REQUEST['maximum_price'] = $price_range['maximum_price'];
    }
    // Snippet title
    $snippet_title = snippet_title($_REQUEST['snippet_title']);
    if (!empty($snippet_title)) {
        // Print Heading
        echo '<h2>' . $snippet_title . '</h2>';
        $page_title = $snippet_title;
    }
}
// Build Query
$search_vars = $idx->buildWhere($idx, $db_idx, 't1');
$search_where = $search_vars['search_where'];
$search_title = $search_vars['search_title'];
// Set Page Title
if (!empty($search_title) && empty($page_title) && empty($snippet_title)) {
    $page_title = strip_tags($search_title);
}
/**