网址不喜欢&符号

Do I have to worry about the error warning (Notice: Undefined index: page in...) when the url is username=guest&page=1 since previously it was username=guest&page=1?

It only happens when I test 'log in' and 'log off'.

The URL comes from htmlspecialchars($_SERVER['REQUEST_URI'])

Any way to just convert & back to &?

If not, I'll just find a way to remove

The problem is you're using htmlspecialchars on $_SERVER['REQUEST_URI']. If you just echoed the request URI, you'd have no problems with the ampersands.