<commit_before><?php

require_once 'lib/common.php';

$pdo = getPDO();
$stmt = $pdo->prepare(
    'SELECT title, created_at, body
    FROM POST
    WHERE id=:id
    '
);
if($stmt == FALSE)
{
    throw new Exception("There was a problem preparing this query");
}

$result= $stmt->execute(
    array('id' => 1, )
);
if($result == false)
{
    throw new Exception("There was a problem executing this query");
}

$row = $stmt->fetch(PDO::FETCH_ASSOC);

$bodytext = HTMLEscape($row['body']);
$paratext = str_replace("\n", "</p><p>", $bodytext)
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>A Blog Application |
        <?php echo HTMLEscape($row['title']) ?></title>
</head>
<body>
    <?php require 'templates/title.php'; ?>

    <h2>
        <?php
            echo HTMLEscape($row['title']);
        ?>
    </h2>
    <div>
        <?php echo $row['created_at'] ?>
    </div>
    <p>
        <?php echo $paratext ?>
    </p>
</body>
</html><commit_msg>change view-post to display post as per as post_id<commit_after><?php

require_once 'lib/common.php';

// get the post id
if(isset($_GET['post_id']))
{
    $postId = $_GET['post_id'];
}
else
{
    $postId = 0;
}

$pdo = getPDO();
$stmt = $pdo->prepare(
    'SELECT title, created_at, body
    FROM POST
    WHERE id=:id
    '
);
if($stmt == FALSE)
{
    throw new Exception("There was a problem preparing this query");
}

$result= $stmt->execute(
    array('id' => $postId, )
);
if($result == false)
{
    throw new Exception("There was a problem executing this query");
}

$row = $stmt->fetch(PDO::FETCH_ASSOC);

$bodyText = HTMLEscape($row['body']);
$paraText = str_replace("\n", "</p><p>", $bodyText)
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>A Blog Application |
        <?php echo HTMLEscape($row['title']) ?></title>
</head>
<body>
    <?php require 'templates/title.php'; ?>

    <h2>
        <?php
            echo HTMLEscape($row['title']);
        ?>
    </h2>
    <div>
        <?php echo $row['created_at'] ?>
    </div>
    <p>
        <?php echo $paraText ?>
    </p>
</body>
</html>
{'fraction_non_alphanumeric': 0.20292590844738084, 'fraction_numerical': 0.0037753657385559227, 'mean_word_length': 3.015151515151515, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1248076', 'n_tokens_mistral': 777, 'n_tokens_neox': 768, 'n_words': 187}