Use mb_substr instead of substr for safety