#!/usr/bin/perl
print "content-type: text/html\r\n\r\n";
$HOLD=$ENV{QUERY_STRING};
@return1 = split(/&/,$HOLD);
@out=split(/F/,$return1[0]);
$DROOT=join('/','', $out[1]);
@out=split(/=/,$return1[1]);
$FNAME=$out[1];
@out=split(/=/,$return1[2]); 
$DAYS= $out[1];
chdir("$DROOT");

print("<html><head><title>New pages</title></head>");
print("<body><h1>Pages created or changed in the last $DAYS days.</h1>");

$FDATE=join('-','', $DAYS);
print("<hr>");

open (FOO, "-|") || exec 'find', '.', '-ctime', "$FDATE" , '-name',"$FNAME",'-printf', '%p\n';

@pages = <FOO>;
foreach $page (@pages) {
   @out=split(/\.\//,$page);
   $tmp=join('/','',$out[1]);
   $new=substr($tmp,0,length($tmp)-1);
   print("<a href=",$new,">",$new,"</a><br>\n");
}

print("<hr>\n<h2>End of list.</h2></html>\n");
