Template:isValidPageName/documentation

Returns "valid" if the first parameter is a valid pagename, otherwise the empty string.