added many to many relationship and few optimisations
added many to many relationship and few optimisations

* only load count if result is bigger than limit and if there is a limit
* only load relationships if one or more result is found

corelibphp/core