}
}
$interface = new databaseInterface();
if (isset($_GET['search'])) {
    if ($_GET['search'] == 'latest') {
        if (isset($_GET['tag'])) {
            $result = $interface->getByTag(htmlspecialchars($_GET['tag']), 'blog_items', 'date');
        } else {
            $result = $interface->getByDate('blog_items');
        }
    } else {
        if ($_GET['search'] == 'popular') {
            if (isset($_GET['tag'])) {
                $result = $interface->getByTag(htmlspecialchars($_GET['tag']), 'blog_items', 'popular');
            } else {
                $result = $interface->getByViews('blog_items');
            }
        } else {
            $result = $interface->getAll('blog_items');
        }
    }
} else {
    header("Location: Page-blog.php?search=latest&tag=" . $_GET['tag']);
}
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <meta charset="utf-8">
        <title></title>
    }
}
$interface = new databaseInterface();
if ($_GET['search'] != null) {
    if ($_GET['search'] == 'latest') {
        if (isset($_GET['tag'])) {
            $result = $interface->getByTag(htmlspecialchars($_GET['tag']), 'project_items', 'date');
        } else {
            $result = $interface->getByDate('project_items');
        }
    } else {
        if ($_GET['search'] == 'popular') {
            if (isset($_GET['tag'])) {
                $result = $interface->getByTag(htmlspecialchars($_GET['tag']), 'project_items', 'popular');
            } else {
                $result = $interface->getByViews('project_items');
            }
        } else {
            $result = $interface->getAll('project_items');
        }
    }
} else {
    header("Location: Page-projects.php?search=latest&tag=" . $_GET['tag']);
}
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <meta charset="utf-8">
        <title></title>