<commit_before><?php
    /* Generates the actual RSS feed from the database */
    header("Content-Type: text/plain"); //Just temporarily, for debudding
    require('lib.php');
    $db = db_connect();

    $feed = get_feed($db, $_GET['f']);
    $articles = article_list($db, $_GET['f']);

    echo '<?xml version="1.0" encoding="ISO-8859-1" ?>';
?>
<rss version="2.0">
    <channel>
        <title><?= $feed['title'] ?></title>
        <link><?= $feed['link'] ?></link>
        <description><?= $feed['description'] ?></description>
        <? if ($feed['category']!='') { ?>
        <category><?= $feed['category'] ?></category>
        <? } if ($feed['copyright']!='') { ?>
        <copyright><?= $feed['copyright'] ?></copyright>
        <? } if ($feed['image_url']!='') { ?>
        <image>
            <url><?= $feed['image_url'] ?></url>
            <title><?= $feed['image_url'] ?></title>
            <link><?= $feed['image_link'] ?></link>
        </image>
        <? } if ($feed['language']!='') { ?>
        <language><?= $feed['language'] ?></language>
        <? } if ($feed['webmaster']!='') { ?>
        <webMaster><?= $feed['webmaster'] ?></webMaster>
        <? } if ($feed['editor']!='') { ?>
        <managingEditor><?= $feed['editor'] ?></managingEditor>
        <? } ?>
        <generator>RSS Creator</generator>

        <!-- Feed Items -->
        <? foreach ($articles as $a) { ?>
        <item>
            <title><?= $a['title'] ?></title>
            <link><?= $a['link'] ?></link>
            <description><?= $a['description'] ?></description>
            <? if ($a['author']!='') { ?>
            <author><?= $a['author'] ?></author>
            <? } if ($a['category']!='') { ?>
            <category><?= $a['category'] ?></category>
            <? } ?>
            <pubDate><?= date('D, d M Y g:i:s O',$a['pubDate']) ?></pubDate>
        </item>
        <? } ?>
    </channel>
</rss>
<commit_msg>HTTP Headers for RSS<commit_after><?php
    /* Generates the actual RSS feed from the database */
    require('lib.php');
    $db = db_connect();

    $feed = get_feed($db, $_GET['f']);
    $articles = article_list($db, $_GET['f']);

    header("Content-Type: application/rss+xml");
    header(
        "Content-Disposition: attachment; filename=\"{$feed['title']}.rss\"");

    echo '<?xml version="1.0" encoding="ISO-8859-1" ?>';
?>
<rss version="2.0">
    <channel>
        <title><?= $feed['title'] ?></title>
        <link><?= $feed['link'] ?></link>
        <description><?= $feed['description'] ?></description>
        <? if ($feed['category']!='') { ?>
        <category><?= $feed['category'] ?></category>
        <? } if ($feed['copyright']!='') { ?>
        <copyright><?= $feed['copyright'] ?></copyright>
        <? } if ($feed['image_url']!='') { ?>
        <image>
            <url><?= $feed['image_url'] ?></url>
            <title><?= $feed['image_url'] ?></title>
            <link><?= $feed['image_link'] ?></link>
        </image>
        <? } if ($feed['language']!='') { ?>
        <language><?= $feed['language'] ?></language>
        <? } if ($feed['webmaster']!='') { ?>
        <webMaster><?= $feed['webmaster'] ?></webMaster>
        <? } if ($feed['editor']!='') { ?>
        <managingEditor><?= $feed['editor'] ?></managingEditor>
        <? } ?>
        <generator>RSS Creator</generator>

        <!-- Feed Items -->
        <? foreach ($articles as $a) { ?>
        <item>
            <title><?= $a['title'] ?></title>
            <link><?= $a['link'] ?></link>
            <description><?= $a['description'] ?></description>
            <? if ($a['author']!='') { ?>
            <author><?= $a['author'] ?></author>
            <? } if ($a['category']!='') { ?>
            <category><?= $a['category'] ?></category>
            <? } ?>
            <pubDate><?= date('D, d M Y g:i:s O',$a['pubDate']) ?></pubDate>
        </item>
        <? } ?>
    </channel>
</rss>

{'fraction_non_alphanumeric': 0.27455470737913484, 'fraction_numerical': 0.004580152671755725, 'mean_word_length': 2.3800515907136717, 'pattern_counts': {'":': 0, '<': 155, '<?xml version=': 2, '>': 155, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 3}, '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': '3567420', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1281, 'n_words': 237}