Page is a not externally linkable
swa66 - 10:51 pm on Nov 9, 2012 (gmt 0)
preg_replace('/[^A-Za-z0-9-]/','', $search) sounds quite harsh on those who might need to support accented letters (read: non-english text).
But essentially the whitelist approach is the right way: only allow in what you know you can deal with, reject all the rest.