Magnetic to nonmagnetic transition of cerium impurities in (La, Th) alloys