Update history.php

Noticed errors in how it was processing
Added location function