Implements optional fallback in URL::previous().

In case the referer header is not set.
Add tests for URL::previous().