detect rate limit has been reached

x-ratelimit-remaining will be checked now and we give a warning before(!) the rate limit will be reached (and of course WHEN it has been reached, too). the warn threshold is set to 10 but could be increased/decreased if you like.
For this the variable "rate_warn_threshold" is used.
we will produce log output when we are above the threshold, a warning message when between threshold and "0" and a critical error when 0 has been reached.