Its a real pity we do not allow is_int($foo) or is_numeric($foo) by security as default for smarty.
So you cannot check for a numeric or have to create & use a modifier {$oo|intval}.
I almost gave up on this, but then I remembered casting to be allowed, so