<?php
/// recentchanges.php --- Recent changes to the VAGUE Web site.

// Copyright (C) 2008  Aaron Hawley <ashawley@gnu.uvm.edu>

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
// 02110-1301, USA.

// $Id: recentchanges.php,v 1.1 2008-03-13 00:20:55-04 ashawley Exp $

$page_title 'Recent Changes';
include 
'header.php';
$file "ChangeLog";
$last_n_logs 3;
?>
<p>The following are the the last <?php print $last_n_logs?> entries
in the change log for the Web site.</p>
<?php include "navigation.html"?>

<pre><?php
$lines 
file($file);
$changes = array();
$date null;
foreach (
$lines as $line) {
    if (
strpos($line'2') === 0) { // Y3K (and Y1K) bug!
        
$date preg_replace('/ +<.*$/'""$line); // Kill email address.
        
$changes[$date] = array(); // Should be a unique key.
    
} else if (isset($date)) {
        
$changes[$date][] = $line;
    } 
// else ignore garbage at top of file.
}
foreach (
array_splice($changes0$last_n_logs) as $date => $lines) {
    print 
htmlspecialchars($date);
    print 
htmlspecialchars(join(""$lines)) . "\n";
}
// <p><a href="recentchanges.php?all">View all changes</a>.</p>
?></pre>
<hr />

<?php
include 'footer.php';
?>