or should I sanitize earlier at the $input->post->list?
I think it's probably just whatever you find most useful in your situation. But my preference is usually to sanitize on first access, unless I potentially need an unsanitized version to determine how it should be sanitized (which might be the case here).
The $value is tricky because it could be an integer or it could be the string "root". Maybe use an if on this one?
You could sanitize first with pageName (which sanitizes to [-_.a-z0-9], and then use ctype_digit to determine if it's an integer or string:
$value = $sanitizer->pageName($input->post->something);
if(ctype_digit("$value")) {
// it's an integer
$value = (int) $value;
} else {
// it's a string
}





Find content
Male
