#!/usr/bin/env perl
do "common.pl";

@code_404;
@hits;
%seen;

open(FILE,$file);
while(<FILE>) {
    /\S*\ \S*\ \S*\ \S*\ \S*\ \S*\ (\S*)\ \S*\ (\S*)\ /;
    $url = $1;
    $status = $2;
    $hits[$status]++;
    if ( $status == 404 ) {
        if ( not exists $seen{$url} ) {
            $seen{$url} = $status;
            push(@code_404, $url);
        }
    };
    $status_code{$url} = $status;
}
close(FILE);

$total_hits = 0;
($total_hits+= $_ ) for @hits;

print "404/total hits: $hits[404]/$total_hits ",
percent($hits[404],$total_hits), "\n";
print "Different 404 url's: ", scalar(@code_404), " ",
percent(scalar(@code_404),$hits[404]), "\n";
exit(0);
