<commit_before><?php
    define('__ROOT__',dirname(__FILE__));
    require __ROOT__.'/class/Page.class.php';
    require __ROOT__.'/class/Food.class.php';
    $p = new Page("Food", false);
    if (!isset($_GET["item"])) {
        $p->buildHead();
        $p->buildHeader();
        require __ROOT__.'/class/template/404.php';
        $p->buildFooter();
        return;
    }
    $food = new Food(intval($_GET["item"]));
    if (empty($food->item)) {
        $p->buildHead();
        $p->buildHeader();
        require __ROOT__.'/class/template/404.php';
        $p->buildFooter();
        return;
    }
    $owner = new User($food->item["user_username"]);
    $ownerProfile = $owner->getPublicProfile();
    $isOwner = $food->item["user_username"] == $p->user->username;
    $gone = $food->item["item_gone"];
    $p->name = $food->item["name"];
    $p->buildHead();
    $p->buildHeader();
?>
    <div class="col-sm-3">
        <div class="card food-item">
            <?php if (! empty($food->item["image_url"])) { ?>
                <img src="<?php echo $food->item["image_url"]; ?>" class="card-img-top">
            <?php } ?>
            <div class="card-block">
            <?php if ($isOwner) { ?>
                <div class="btn-group btn-group-fullwidth" role="group" aria-label="...">
                    <a class="btn btn-primary" href="edititem.php?item=<?php echo $food->item["id"];?>" role="button">Edit</a>
                    <a class="btn btn-danger" href="deleteitem.php?item=<?php echo $food->item["id"];?>" role="button" id="deleteItem">Delete</a>
                    <script>
                        $(document).ready(function() {
                            $("#deleteItem").click(function(e) {
                                var response = window.confirm("Are you sure you want to delete the item? This is undoable!");
                                if (response == false) {
                                    return false;
                                }
                            })
                        });
                    </script>
                </div>
            <?php } else { ?><commit_msg>also update on load of item page<commit_after><?php
    define('__ROOT__',dirname(__FILE__));
    require __ROOT__.'/class/Page.class.php';
    require __ROOT__.'/class/Food.class.php';
    $p = new Page("Food", false);
    if (!isset($_GET["item"])) {
        $p->buildHead();
        $p->buildHeader();
        require __ROOT__.'/class/template/404.php';
        $p->buildFooter();
        return;
    }
    $food = new Food(intval($_GET["item"]));
    if (empty($food->item)) {
        $p->buildHead();
        $p->buildHeader();
        require __ROOT__.'/class/template/404.php';
        $p->buildFooter();
        return;
    }
    $owner = new User($food->item["user_username"]);
    $owner->updateScore();
    $ownerProfile = $owner->getPublicProfile();
    $isOwner = $food->item["user_username"] == $p->user->username;
    $gone = $food->item["item_gone"];
    $p->name = $food->item["name"];
    $p->buildHead();
    $p->buildHeader();
?>
    <div class="col-sm-3">
        <div class="card food-item">
            <?php if (! empty($food->item["image_url"])) { ?>
                <img src="<?php echo $food->item["image_url"]; ?>" class="card-img-top">
            <?php } ?>
            <div class="card-block">
            <?php if ($isOwner) { ?>
                <div class="btn-group btn-group-fullwidth" role="group" aria-label="...">
                    <a class="btn btn-primary" href="edititem.php?item=<?php echo $food->item["id"];?>" role="button">Edit</a>
                    <a class="btn btn-danger" href="deleteitem.php?item=<?php echo $food->item["id"];?>" role="button" id="deleteItem">Delete</a>
                    <script>
                        $(document).ready(function() {
                            $("#deleteItem").click(function(e) {
                                var response = window.confirm("Are you sure you want to delete the item? This is undoable!");
                                if (response == false) {
                                    return false;
                                }
                            })
                        });
                    </script>
                </div>
            <?php } else { ?>
{'fraction_non_alphanumeric': 0.18805002315886984, 'fraction_numerical': 0.003242241778601204, 'mean_word_length': 1.7318153067678685, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 86, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2379792', 'n_tokens_mistral': 1273, 'n_tokens_neox': 1232, 'n_words': 223}