Fixed some bugs in api_statistics

End was set to a non-unix time value
Now using queries that are closer to what you see in the settings page