Apply urldecode() if necessary

The code here works on URL components directly obtained from the URL. Therefore, urldecode() should be applied to them before these parts are used to do any kind of comparison.