Add a Max history configuration option

In an effort to keep the things fast and the database small-ish, add a max-history configuration option.

In order to make comparisons to previous scans, we need to require that some history exists, so keep the max_history at a minimum of 2.

This will automatically remove old scans after a new scan has completed.