add caching to stats.php
fix records.php