On some pages, i receive the error:
PHP Notice: Undefined offset: 1 in /var/www/example.com/includes/head.php on line 23
Here
list($r1, $r2) = explode(" ", $r[0],2);
When supplied with two variables, list() will need an array with at least 2 items.
However, as the error you mentioned indicates, your explode() call seems to return an array with only one item.
You will have to check the contents of $r[0] to make sure it actually contains your splitting character or manually assign $r1 and $r2 with sanity checks.