urlencode for placeholders

Placeholders should be urlencoded, because $base_url is also urlencoded. So $base_url may look like this:
.../statistics/image/%25key/%25mode/%25image_number