Rule 401.7 · Library
If an effect causes a player to put a card into a library “Nth from the top,” and that library has fewer than N cards in it, the player puts that card on the bottom of that library.
If an effect causes a player to put a card into a library “Nth from the top,” and that library has fewer than N cards in it, the player puts that card on the bottom of that library.
Ask the judge Pro
The life counter has an AI judge that answers your play citing the exact rules. It is part of Gatewatch Pro; the rules, Oracle text and rulings stay free.