Astrophysical origins of ultrahigh energy cosmic rays