It seems that the setlocale function used in lib/config.php detects the language used in the page. Therefore, the duration problem when trying to save the access log to the database occurs on some of the PgsrcTranslation pages.
In order to solve this, I added a cast to string to the duration in lib/WikiDB/backend.php on line 628 like this:
I am not sure whether this is the best way to do it. Maybe it would be more usefull to reset the locale to default using "setlocale(LC_ALL, NULL);", but I'm not sure when this would be most useful.