Fix #343
Fixed parent issue
Merge pull request #347 from sylvaindeloux/master

Fixed parent issue
check pageId closely

I don't know how yet, but I managed to get false as pageId in this
method call. This triggers a very ugly database error. Here is a
replacement with an exception. As a bonus, you get a unit test.
return null when target_id is false

There is no point to check the database if target_id is false. This
commit comes with a unit test