fix error in twig_first/twig_last when mbstring not present

twig_slice returned different content when mbstring was available as
mb_substr returned empty string when bounds were exceeded, whereas
substr returns false.  added twig_substr to emulate this behaviour.