[PATCH] Let X-FORWARDED-FOR supersede REMOTE_ADDR.

Hi,

This patch makes logstats use the X-FORWARDED-FOR instead of REMOTE_ADDR in case X-FORWARDED-FOR is set in order for logstats to read the correct IP address in case dokuwiki is behind a reverse proxy.

There are cases where dokuwiki sits behind squid, varnish or even apache acting as a reverse proxy and in the current format, logstats is unable to get the real IP address. What is worse, is that if dokuwiki is behind a reverse proxy, logstats will only see one single address (the address of the upstream proxy) which will give out entirely wrong visitor counts.

By using this patch, logstats first checks whether the X-FORWARDED-FOR header exists, and if it does, then it uses that as the IP address. In case X-FORWARDED-FOR does not exist, then it uses the regular REMOTE_ADDR to grab the IP address.

Kind regards,
Eva
Oh ok, so clientIP()...

Is the change to:

$host      = clientIP(true);

acceptable?

Should I create a new patch and pull request?

Thanks