Updated history handling to support the Contao 3.1 referer IDs