| DB connection failed';
    return;
}
$amount = 0.0;
$max_month  = 0.0;
$total_year = 0.0;
$donation_count = 0.0;
$sql_donations = mysqli_query($db_link, "SELECT * FROM donations WHERE YEAR(dt) = " . $year);
if (mysqli_num_rows($sql_donations)) {
    while ($sql_row = mysqli_fetch_assoc($sql_donations)) {
        $amount = $sql_row["amount"];
        $donation_count += 1.0;
        if ($amount > $max_month) {
            $max_month = $amount;
            if ($amount > $GLOBALS['biggest_donation_value']) {
                $GLOBALS['biggest_donation_date']  = date("Y-m-d", strtotime($sql_row["dt"]));
                $GLOBALS['biggest_donation_value'] = $amount;
            }
        }
        $total_year += $amount;
    }
}
$GLOBALS['total_ever'] += $total_year;
echo ' | ';
echo '  | ' . $year . '';
echo ' | ' . $donation_count . '';
echo ' | ' . number_format($total_year, 2) . '€';
if ($donation_count > 0.0) {
    echo ' | ' . number_format($total_year/$donation_count, 2) . '€';
} else {
    echo ' | 0€';
}
echo ' | ' . number_format($total_year/12.0, 2) . '€';
echo ' | ' . number_format($max_month, 2) . '€';
echo ' | 
';
}
?>
    KXStudio is and always will be a free and open-source project to everyone.
    Donations help ensure that developers have the needed enthusiasm and motivation to keep working on the project.
    Just because we're open-source doesn't mean we're allergic to money. ;)
    This page contain statistics regarding donations made to the KXStudio project over time.
    | Year | Donation count | Total received | Average per donation | Average per month | Biggest single donation | 
= "2013"; $year -= 1) {
    print_donation_year($year);
}
?>
 
    So far the KXStudio project has received € in donations.
    The biggest donation ever made was on , with a value of €.
    Thank you very much for your generosity!