Escape input that goes in HTML; Reworked search history insert SQL