Child rapist given three-year sentence